Welcome to WebmasterWorld Guest from 54.198.210.67

Forum Moderators: Ocean10000 & incrediBILL & phranque

Need a MAMP Extensionless URL Fix

it's not rewriting .html requests

     
7:25 pm on Oct 21, 2017 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month

joined:June 4, 2002
posts: 1830
votes: 3


I haven't used MAMP for several years so a bit rusty. I have spent about 12 hours since yesterday researching it again. I have MAMP set up and it's working for most htaccess requests (rewrite to non-www, loading custom 404 for typos, parsing files). BTW, I had to write in the full url for the custom 404 to get it to work.

However, the extensionless rewrite isn't working (I got it off an old JD Morgan page of instructions on the same) as the explanations help to explain what's going on..

When I enter localhost/example.com in the browser all pages load with all images as expected.

When I try to test to see if the extensionless URL is working by typing in a page.html, i.e.,
localhost/example.com/contact.html
it goes from localhost to the actual domain (which doesn't have this file loaded yet). It shows the data of the custom 404 page but the header,menu, footer aren't loading. Here is the path (which is an error as this site is only 2 levels deep):
http://example.com/home/user/public_html/contact.html
It was doing the same thing before I added the full url to the ErrorDocument 404

I have the rewrite to non-www below this bit of code and it's working.

Can someone see my mistake below?
--
Here is the relevant htaccess: (I have example changed to actual domain in the original file)

RewriteEngine on
#
#EXTENSIONLESS URL FIX
# Internally rewrite extensionless file requests to .html files ##
# If the requested URI does not contain a period in the final path-part
RewriteCond %{REQUEST_URI} !(\.[^./]+)$
# and if it does not exist as a directory
RewriteCond %{REQUEST_FILENAME} !-d
# and if it does not exist as a file
RewriteCond %{REQUEST_FILENAME} !-f
# then add .html to get the actual filename
RewriteRule (.*) /$1.html [L]
#
# Externally redirect clients directly requesting .html page URIs to extensionless URIs
# If client request header contains html file extension
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^.]+\.)+html\ HTTP
# externally redirect to extensionless URI
RewriteRule ^(.+)\.html$ http://example.com/$1 [R=301,L]
#
9:08 pm on Oct 21, 2017 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month

joined:June 4, 2002
posts: 1830
votes: 3


PS. I just realized that when I type in a typo it goes to the main website online and uses that 404 file and not localhost so that's not working either.

I'm wondering if I have the files set up correctly. I loaded the website files in a folder within htdocs, i.e.,
applications/mamp/htdocs/example/

I also tried putting all the files directly into the htdocs file, and that also reverted to the main website online for the 404 page. I assume that's because I have the full url in the 404 error.

if I type in the browser: localhost/index.html that also goes to the main website online to the 404 page but cuts the .html off the "index"

Now I'm really confused.
9:32 pm on Oct 21, 2017 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month

joined:Apr 9, 2011
posts:14251
votes: 551


For your MAMP site (and similarly for WAMP and so on) you can't just copy your “real” htaccess. You ned to go through and globally replace all occurrences of
http://www.example.com/
with
/
alone, so redirects stay on MAMP.

I have the full url in the 404 error.
Do you mean in the ErrorDocument directive? I hope not, because that's a serious error whether on a live site or MAMP. Or is there an internal redirect in the 404 page itself?

[edited by: lucy24 at 9:35 pm (utc) on Oct 21, 2017]

9:33 pm on Oct 21, 2017 (gmt 0)

Administrator

WebmasterWorld Administrator phranque is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Aug 10, 2004
posts:11073
votes: 106


Generally speaking the external redirect should occur before the internal rewrite.

Also your external (extensionless) redirect is explicitly redirecting to the canonical hostname instead of the requested hostname which in this case was "localhost".
6:39 pm on Oct 22, 2017 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month

joined:June 4, 2002
posts: 1830
votes: 3


@Lucy24 re can't use real htaccess. Thanks for that info. That makes sense. I fixed the htaccess for the 404 error page

I have been searching all over the internet and YouTube for instructions on how to set up htaccess and page files for last 2 days and can't find anything that pertains to my situation. I'm not using PHP or MySQL or any CMS. I write code by hand. Even the MAMP manuals don't go that far. I've gathered data by bits and pieces. Do you know of a source for this info?

@phranque I took out the external www Fix and moved the external extensionless redirect above the internal. However, I don't understand what you said about it's redirecting to the canonical hostname. Can you show me where it is redirecting to the canonical hostname?

I've been using localhost/index.html to call up the page which may be part of the problem. I just tried launching localhost itself and the page loaded like it should. I then tried one of the pages with .html and it reverted to the online site, and also if I click on one of the menu links. So whatever needs fixing is likely in the external extensionless redirect.
7:35 pm on Oct 22, 2017 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month

joined:Apr 9, 2011
posts:14251
votes: 551


Have another look at your .htaccess--the one that's used by your MAMP site, not the "real" one. You may simply have overlooked one of the redirect targets. In fact just search for your sitename; it should not occur anywhere except possibly in a # comment line.

ymmv but here's what works for me:
-- By default, MAMP looks for "localhost" site files in the MAMP directory. I find this extremely inconvenient--the darn things are buried about 8 directories deep--so I pointed it to where I already store my site files, one click away from the desktop. (I forget where the setting is, but it is very easy to change.)
-- On my HD, in the directory for each site, I have a folder called "top-level files" which, unlike everything else in the directory, is not directly uploaded to the server. That's where I keep things like robots.txt, site-verification files, htaccess and so on--things that have to go in the root directory on the live site, but on my HD there is no need for the clutter. The htaccess file is saved as something like "htaccess_abc.txt" without leading dot, because it needs to be visible and editable. When uploaded, it gets its proper name and location.
-- Also in each site's directory is a file called .htaccess with leading dot. This is the functional htaccess that kicks in when I use MAMP. (Since my real site relies on htaccess, I decided it's counterproductive to put things in the config file. You may need to put in an AllowOverrides line; I don't remember the MAMP default.) It is the same as the live site's htaccess with two changes: I've deleted most of the access-control rules because they are obviously not needed on localhost, and as noted above, all occurrences of http://www.example.com/ are replaced with / alone.
-- I run multiple sites on MAMP. There are at least two different ways to do this; what I've done is set up "sitename.local" for each site, and this points the browser to the local file. (If ".local" ever gains widespread currency as a TLD, I am sunk!)

also if I click on one of the menu links

Now, that sounds as if you've got hard-coded "http://www.example.com/" in your HTML. Get rid of it; all you ever need for internal links is a leading / slash.
8:46 pm on Oct 22, 2017 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month

joined:June 4, 2002
posts: 1830
votes: 3


@ Lucy24

Thanks for your helpful tips.

In MAMP preferences I have "my favorite link" set to "localhost"
On the web server page in preferences the root is "mac/apps/MAMP/htdocs.

I only have the one MAMP site so won't bother trying to link it where I store my other sites.

I have a note in my other site files for this particular domain "Open via MAMP".

I added an alias to "favorites" for htdocs for easy access to the files.

I found a widget for the mac that turns on hidden files (.htaccess) and I'm easily able to open and edit it, and turn if off if needed. BTW, I'm on Sierra.

I checked the config file and AllowOverrides was already on.

I changed all the menu links on html pages to relative and commented out all the canonical tags.

There is no reference to example.com in the htaccess file now
and I removed everything except what is need to load the includes, custom 404 and check the extensionless action.

--------

With all those changes, when I go to localhost in the browser: the home page loads correctly

however if I enter localhost/contact.html then it reverts to the online site's 404 page in a strange folder where css isn't located so it's still picking up the domain name from somewhere.
12:09 am on Oct 23, 2017 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month

joined:Apr 9, 2011
posts:14251
votes: 551


Is /contact.hml located in the same physical directory as the overall /index.html page? It needs to be, for MAMP to be able to find it. Well, for that matter, it needs to be there for your live site to be able to find it too, assuming the URL there too is example.com/contact.html.

Overall, the directory structure for your local files--as used by MAMP--needs to be exactly the same as for your live site.

it reverts to the online site's 404 page

This should simply not be happening.

Unlike some things, the MAMP .htaccess and live-site .htaccess should contain exactly the same ErrorDocument directives. What does each one currently say?

Note too that custom error documents such as 404 and 403 are really a special kind of rewrite: the browser doesn't know where it “really” is, but “thinks” it is in the originally requested document. So you have to make certain that any and all css links use site-absolute URLs beginning in / slash. If you're getting the error document without styles, it is almost certainly because the browser is looking in the wrong place.

Now, once in a blue moon I'll find that my browser, and/or my MAMP installation, gets the hiccups and some random page will load up without its CSS. (Ugh!) But refresh the page and everything looks as intended.
1:44 am on Oct 23, 2017 (gmt 0)

Administrator

WebmasterWorld Administrator phranque is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Aug 10, 2004
posts:11073
votes: 106


@phranque I took out the external www Fix and moved the external extensionless redirect above the internal. However, I don't understand what you said about it's redirecting to the canonical hostname. Can you show me where it is redirecting to the canonical hostname?

this:
RewriteRule ^(.+)\.html$ http://example.com/$1 [R=301,L] 

(assuming example.com is your canonical hostname)
in your case perhaps that should be changed to this:
RewriteRule ^(.+)\.html$ http://localhost/$1 [R=301,L] 
2:08 am on Oct 23, 2017 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month

joined:June 4, 2002
posts: 1830
votes: 3


@Lucy24

Yes /contact.html is located in same directory as /index.html (same as the site online). There are only 10 html pages in the root and one folder with 11 more pages but I haven't checked the later yet.

I removed all mention of example.com on all the pages and htaccess so don't know where MAMP is getting that domain from.

Localhost: ErrorDocument 404 /missing.html
online site: ErrorDocument 404 /missing.html

Re CSS links - there are no links in CSS.

@ Phranque.

Re the example.com that was in the WWW fix. I took that out as it's an external directive and assume it's not needed while on localhost.

Here is what is currently in the .htaccess file.

ErrorDocument 404 /missing.html
AddHandler server-parsed .html
#
Options +FollowSymLinks +Includes
RewriteEngine on
#
#EXTENSIONLESS URL FIX
# Externally redirect clients directly requesting .html page URIs to extensionless URIs
# If client request header contains html file extension
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^.]+\.)+html\ HTTP
# externally redirect to extensionless URI
RewriteRule ^(.+)\.html$ /$1 [R=301,L]
#
# Internally rewrite extensionless file requests to .html files ##
# If the requested URI does not contain a period in the final path-part
RewriteCond %{REQUEST_URI} !(\.[^./]+)$
# and if it does not exist as a directory
RewriteCond %{REQUEST_FILENAME} !-d
# and if it does not exist as a file
RewriteCond %{REQUEST_FILENAME} !-f
# then add .html to get the actual filename
RewriteRule (.*) /$1.html [L]
#
2:49 am on Oct 23, 2017 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month

joined:Apr 9, 2011
posts:14251
votes: 551


Incidentally... Unless you have really, really bizarre URLs, for this
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^.]+\.)+html\ HTTP
you need only say
RewriteCond %{THE_REQUEST} \.html
You've already captured in the body of the rule, so there's no need to get complicated. (And no matter what you do, the parentheses aren't needed.) The alternative is to turn it around and capture from the Condition instead:
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^.]+\.)+html\ HTTP
# externally redirect to extensionless URI
RewriteRule \.html$ /%1 [R=301,L]
3:57 pm on Oct 23, 2017 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month

joined:June 4, 2002
posts: 1830
votes: 3


@lucy24

Thanks for the info above. I do have only simple html pages.

I've been doing more testing:

I noticed that when I open localhost/home page and type in the contact page link it reverts to the online site 404 page with no images, header, menu and footer (only text).

And if I open localhost/home page and click on the same link in the menu it goes to the 404 page in htdocs, with no images, header, menu and footer (only text).

So for some reason the 404 page is not picking up the css file (it works fine on the online site).

The coding on the missing 404 page is the same as all other pages except for the text on the page and I have it set to noindex,nofollow.

You had mentioned at one point that all relevant links in the menu should start with a slash. However, I've never done it that way and pages all worked. I tried adding a slash to one of the relative links in the menu and tested that page and the result was the page reverted to a blank page with nothing but "missing.html" text on the page (that is the link to my custom 404 page).

Could the no slash in front of relative links be the problem? If so, I need to figure out why the page isn't loading.
8:56 pm on Oct 23, 2017 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month

joined:Apr 9, 2011
posts:14251
votes: 551


it reverts to the online site 404 page
You've said this a couple of times and I'm confused. Does your browser's address bar say
example.com/missing.html (or whatever its real URL is)
or does the address bar say
name-of-page-you-were-trying-to-reach
while the browser window displays the text content of your custom 404 page?

What is the exact wording of the CSS link in the error document?

Are the header and footer done via SSIs or as php includes? If SSI, is the 404 page's extension .html or .shtml? If .html alone, does the MAMP site's .htaccess include a line that looks something like
AddOutputFilter INCLUDES .html
?
11:26 pm on Oct 23, 2017 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month

joined:June 4, 2002
posts: 1830
votes: 3


Re testing without a slash in front of menu links:

I open localhost and the home page comes up. I then type in /contact.html and the browser goes here: http://example.com/home/user/public_html/contact.html (however it's the online 404 page without header/menu/footer (text only). For some reason it's picking up the actual domain on that page (possibly from the contact form?)

If I type in another page like this: localhost/faqs.html, it goes here:
localhost and it shows the home page with everything loading.

If I have localhost open and click on one of the links in the menu it goes here:
localhost/faqs/ however again it's the same 404 page without header, etc.

re testing with "/" in front of the faqs.html link.

I have the home page open and click on the faqs.html link in the menu and the page reverts to the 404 page without header etc. The browser location bar shows this: http://localhost/faqs/

Re CSS link. I assume you meant .htaccess as there is no CSS link.

ErrorDocument 404 /missing.html
AddHandler server-parsed .html

The header, menu and footer are SSIs
the 404 page is missing.html

Here is the line that picks up the includes in htaccess.
Options +FollowSymLinks +Includes
RewriteEngine on

I posted the whole htaccess file 2 posts ago.

[edited by: phranque at 2:56 am (utc) on Oct 24, 2017]
[edit reason] unlinked url [/edit]

1:20 am on Oct 24, 2017 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month

joined:Apr 9, 2011
posts:14251
votes: 551


there is no CSS link
Yes, there is. How else would the error document (custom 404 page) know what stylesheet to use? And there is obviously an external stylesheet, or the 404 page would not be showing up unstyled, as you describe:
for some reason the 404 page is not picking up the css file
3:20 am on Oct 24, 2017 (gmt 0)

Administrator

WebmasterWorld Administrator phranque is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Aug 10, 2004
posts:11073
votes: 106


I then type in /contact.html and the browser goes here: http://example.com/home/user/public_html/contact.html (however it's the online 404 page without header/menu/footer (text only).


something is exposing your internal directory structure in an external redirect.
what is causing this redirect?

i would check the server configuration files for Redirect/RedirectMatch (mod_alias) or other mod_rewrite directives not posted above.

there is no external redirect to example.com in your most recently posted .htaccess file.
what is causing this redirect?

i would use a header checker tool such as Live HTTP headers for FF or the Network tab in Chrome developer tools so you understand exactly what requests are being sent from the browser and what responses are received from the server.

you need to describe your above quote in terms of The Request that was sent by your browser, the relevant HTTP Request headers, the status code of the HTTP Response, the relevant HTTP Response headers, and the body of the response.
you should include the entire chain of redirects, if any, in your description.
in all descriptions you should include what you expected to see and what you actually observed.
once you have solved the problem with the document request, you can start looking at the other resources referred to by that document. (i.e. images/scripts/style sheets)

i would also look for any relevant clues in the server access log and server error log files.
3:21 pm on Oct 24, 2017 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month

joined:June 4, 2002
posts: 1830
votes: 3


@lucy24

Sorry I didn't understand what you were asking.

>What is the exact wording of the CSS link in the error document?

<link rel="stylesheet" type="text/css" href="abbreviationofdomain.css">

All the pages I've tested, the style sheet and custom 404 page are all in the root.
4:05 pm on Oct 24, 2017 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month

joined:June 4, 2002
posts: 1830
votes: 3


@Phrangue

I loaded a http header (haven't used one in a long time), then I opened local host (the home page) and typed in contact.html and the first thing that shows in the http header doc is:

http://localhost/contact.html
Host: domain.com

i would check the server configuration files for Redirect/RedirectMatch (mod_alias) or other mod_rewrite directives not posted above.


I searched for all 3 of those terms in the conf file but only found this:

LoadModule alias_module modules/mod_alias.so

I've only checked the httpd.conf file one other time to confirm that AllowOverride All was active and it is. I haven't made any changes to this document. So I don't know how it can be picking up the domain name of the site in question (I searched for that also).

I also scrolled through the conf file and didn't see any mention of the domain in question.

I checked the apache log this morning after testing the page again and found this:

[Tue Oct 24 08:31:36 2017] [error] [client fe80::1] File does not exist: /Applications/MAMP/htdocs/assets, referer: http://localhost/aascc.css

So it doesn't see the css file which is in htpdoc. The css file is in the root of htpdoc like the pages I've tested.

Here is the actual style sheet link on the contact page:
<link rel="stylesheet" type="text/css" href="aascc.css">

[edited by: phranque at 8:18 pm (utc) on Oct 24, 2017]
[edit reason] Unlinked URLs for clarity [/edit]

5:27 pm on Oct 24, 2017 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month

joined:June 4, 2002
posts: 1830
votes: 3


I did some more testing. I removed the contact form, google map and canonical tag (which was commented out) from the contact page and went to localhost/contact.html and checked the http header again and this time is went to localhost (like it does for the other pages). So it was picking up the link to domain in contact form or ...

However when it reverts to localhost it is showing the home page and not the page requested, like when I tested the faqs page earlier.
6:54 pm on Oct 25, 2017 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month

joined:June 4, 2002
posts: 1830
votes: 3


I made some more changes trying to figure out why the right page doesn't show up when testing pages. I removed all non-relevant coding so only text, logo, menu js, css is called up.

I open localhost and the home page loads like it should. I then enter localhost/faqs.html
and it reverts to the home page.

I understand how to read most of the http header response but not how to determine why the faqs page isn't loading. Can someone tell by this header response, or is there another tool I should use?




http://localhost/faqs.html

Host: localhost

User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:56.0) Gecko/20100101 Firefox/56.0

Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8

Accept-Language: en-US,en;q=0.5

Accept-Encoding: gzip, deflate

Cookie: SQLiteManager_currentLangue=2; sc_is_visitor_unique=rx11463677.1508953424.EA25315350584FFF2F98A896A7A21A55.14.13.9.8.7.6.1.1.1



http://localhost/aascc.css

Host: localhost

User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:56.0) Gecko/20100101 Firefox/56.0

Accept: text/css,*/*;q=0.1

Accept-Language: en-US,en;q=0.5

Accept-Encoding: gzip, deflate

Referer:

http://localhost/

Cookie: SQLiteManager_currentLangue=2; sc_is_visitor_unique=rx11463677.1508953424.EA25315350584FFF2F98A896A7A21A55.14.13.9.8.7.6.1.1.1



http://code.jquery.com/jquery-latest.min.js

Host: code.jquery.com

User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:56.0) Gecko/20100101 Firefox/56.0

Accept: */*

Accept-Language: en-US,en;q=0.5

Accept-Encoding: gzip, deflate

Referer:

http://localhost/

Cookie: __cfduid=dae2ad082cd98ed3405833c311b510bad1482859132; __utma=160157602.2075088874.1482859134.1482859134.1482859134.1



http://localhost/script.js

Host: localhost

User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:56.0) Gecko/20100101 Firefox/56.0

Accept: */*

Accept-Language: en-US,en;q=0.5

Accept-Encoding: gzip, deflate

Referer:

http://localhost/

Cookie: SQLiteManager_currentLangue=2; sc_is_visitor_unique=rx11463677.1508953424.EA25315350584FFF2F98A896A7A21A55.14.13.9.8.7.6.1.1.1

Capture

[edited by: engine at 8:01 pm (utc) on Oct 25, 2017]
[edit reason] fixed links [/edit]

8:29 pm on Oct 25, 2017 (gmt 0)

Administrator

WebmasterWorld Administrator phranque is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Aug 10, 2004
posts:11073
votes: 106


This is showing the request headers but it is not showing the response headers or the status code of the responses.
9:55 pm on Oct 25, 2017 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month

joined:Apr 9, 2011
posts:14251
votes: 551


Can someone tell by this header response
You're pasting in the wrong things. Those are the request headers, not the response headers.

Check your LiveHeaders settings. The defaults must have been changed at some point, or you wouldn't be getting one group without the other.
12:29 am on Oct 26, 2017 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month

joined:June 4, 2002
posts: 1830
votes: 3


The http header I was using did not have any options. I tried 5 other Firefox addons before I found one that looked like what is needed (live http headers)

When I go to localhost (it loads home page) and type in faqs.html I get a 200 response however it reverts to home page not and the faqs page.

When I go to localhost and click on the faqs link in the menu then I get a 404 response:

IT WON"T LET ME COPY THE DATA.

It gave a 404 response.

I'll have to type out the data. Please let me know what data you need.
4:11 am on Oct 26, 2017 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month

joined:Apr 9, 2011
posts:14251
votes: 551


IT WON"T LET ME COPY THE DATA.

wtf?
:: testing ::
Double wtf. You also can't drag to select; you have to click at the beginning, hold Shift and click at the end. And even then you can only use the Save All... button so what is the use of selecting at all?

https://aus5.mozilla.org/update/6/Firefox/56.0/20170926190823/Darwin_x86_64-gcc3/en-US/release/Darwin%2013.4.0/ISET:NA,MEM:3840/default/default/update.xml?force=1

GET /update/6/Firefox/56.0/20170926190823/Darwin_x86_64-gcc3/en-US/release/Darwin%2013.4.0/ISET:NA,MEM:3840/default/default/update.xml?force=1 HTTP/1.1
Host: aus5.mozilla.org
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:56.0) Gecko/20100101 Firefox/56.0
Accept: */*
Accept-Language: iu,en-US;q=0.8,en;q=0.7,no;q=0.5,de-DE;q=0.3,la;q=0.2
Accept-Encoding: gzip, deflate, br
Cache-Control: no-cache
Pragma: no-cache
Connection: keep-alive

HTTP/1.1 200 OK
Cache-Control: public, max-age=90
Content-Security-Policy: default-src 'none'; frame-ancestors 'none'
Content-Type: text/xml; charset=utf-8
Date: Thu, 26 Oct 2017 04:05:30 GMT
Strict-Transport-Security: max-age=31536000;
X-Content-Type-Options: nosniff
X-Proxy-Cache-Status: MISS
Content-Length: 42
Connection: keep-alive
That's just the headers I got from opening the About Firefox window to confirm my version number.

Idle query: What the heck is the Connection: header for, if it is always sent and always has the same value?
5:02 am on Oct 26, 2017 (gmt 0)

Administrator

WebmasterWorld Administrator phranque is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Aug 10, 2004
posts:11073
votes: 106


i would use a header checker tool such as Live HTTP headers for FF or the Network tab in Chrome developer tools so you understand exactly what requests are being sent from the browser and what responses are received from the server.

I tried 5 other Firefox addons before I found one that looked like what is needed (live http headers)

since you are on a Mac you could also use the developer tools in Safari to get this information...
4:29 pm on Oct 26, 2017 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month

joined:June 4, 2002
posts: 1830
votes: 3


You people seem to imply that one needs to be an expert in htaccess or live MAMP or http headers before posting in this forum. Isn't this a forum where one can go for help? Where is there a document on the Internet that explains how to use MAMP once it's installed? I haven't found one. I write HTML by hand but I'm not a PHP programmer or server administrator, etc. so all this MAMP, http stuff is new to me.

Here is the "saved" copy of live http header from my recent attempts to figure out why MAMP is not loading images, css, etc. My comment are on the divider line between attempts.

To reiterate. All images, css, etc load fine on the live site. I have all those documents for this site in htdocs (there is only one section that is in another folder (except images) and I haven't checked it yet.) Images are in an "image" folder. file names have .html extensions but have been removed in menu links. I do not have file names in menu starting with a slash.

-----localhost loads fine with all images, css etc working fine ----

http://localhost/

GET / HTTP/1.1
Host: localhost
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:56.0) Gecko/20100101 Firefox/56.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Cookie: sc_is_visitor_unique=rx11463677.1508953424.EA25315350584FFF2F98A896A7A21A55.14.13.9.8.7.6.1.1.1; SQLiteManager_currentLangue=2
Connection: keep-alive
Upgrade-Insecure-Requests: 1

HTTP/1.1 200 OK
Date: Thu, 26 Oct 2017 16:02:19 GMT
Server: Apache/2.2.29 (Unix) mod_fastcgi/2.4.6 mod_wsgi/3.4 Python/2.7.8 PHP/5.6.2 mod_ssl/2.2.29 OpenSSL/0.9.8zh DAV/2 mod_perl/2.0.8 Perl/v5.20.0
Accept-Ranges: bytes
Content-Length: 5271
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: text/html

------------------------------Why its looking in assets for the caret image (in menu) I have no idea as I put all images in an "images" file--------------------------

http://localhost/assets/caret2-white.png

GET /assets/caret2-white.png HTTP/1.1
Host: localhost
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:56.0) Gecko/20100101 Firefox/56.0
Accept: */*
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: http://localhost/aascc.css
Cookie: sc_is_visitor_unique=rx11463677.1508953424.EA25315350584FFF2F98A896A7A21A55.14.13.9.8.7.6.1.1.1; SQLiteManager_currentLangue=2
Connection: keep-alive

HTTP/1.1 404 Not Found
Date: Thu, 26 Oct 2017 16:02:23 GMT
Server: Apache/2.2.29 (Unix) mod_fastcgi/2.4.6 mod_wsgi/3.4 Python/2.7.8 PHP/5.6.2 mod_ssl/2.2.29 OpenSSL/0.9.8zh DAV/2 mod_perl/2.0.8 Perl/v5.20.0
Accept-Ranges: bytes
Keep-Alive: timeout=5, max=99
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: text/html

---------------------This is when I type in faqs.html, it reverts to "faqs" (which says to me the extensionless redirect is working) but it reverts to the localhost (home page) and throws a 404. I don't understand why -----------------------------

http://localhost/faqs/

GET /faqs/ HTTP/1.1
Host: localhost
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:56.0) Gecko/20100101 Firefox/56.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: http://localhost/
Cookie: sc_is_visitor_unique=rx11463677.1508953424.EA25315350584FFF2F98A896A7A21A55.14.13.9.8.7.6.1.1.1; SQLiteManager_currentLangue=2
Connection: keep-alive
Upgrade-Insecure-Requests: 1

HTTP/1.1 404 Not Found
Date: Thu, 26 Oct 2017 16:02:25 GMT
Server: Apache/2.2.29 (Unix) mod_fastcgi/2.4.6 mod_wsgi/3.4 Python/2.7.8 PHP/5.6.2 mod_ssl/2.2.29 OpenSSL/0.9.8zh DAV/2 mod_perl/2.0.8 Perl/v5.20.0
Accept-Ranges: bytes
Keep-Alive: timeout=5, max=98
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: text/html

-------------------This one appears to be looking for images in a faqs folder when there isn't one. The image folder is within localhost---------------------------------------

http://localhost/faqs/images/smart-chiro-logo320b.jpg

GET /faqs/images/smart-chiro-logo320b.jpg HTTP/1.1
Host: localhost
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:56.0) Gecko/20100101 Firefox/56.0
Accept: */*
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: http://localhost/faqs/
Cookie: sc_is_visitor_unique=rx11463677.1508953424.EA25315350584FFF2F98A896A7A21A55.14.13.9.8.7.6.1.1.1; SQLiteManager_currentLangue=2
Connection: keep-alive

HTTP/1.1 404 Not Found
Date: Thu, 26 Oct 2017 16:02:25 GMT
Server: Apache/2.2.29 (Unix) mod_fastcgi/2.4.6 mod_wsgi/3.4 Python/2.7.8 PHP/5.6.2 mod_ssl/2.2.29 OpenSSL/0.9.8zh DAV/2 mod_perl/2.0.8 Perl/v5.20.0
Accept-Ranges: bytes
Keep-Alive: timeout=5, max=97
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: text/html

---------------------------and the same with the css file. It's in the root of localhost-------------------------------

http://localhost/faqs/aascc.css

GET /faqs/aascc.css HTTP/1.1
Host: localhost
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:56.0) Gecko/20100101 Firefox/56.0
Accept: text/css,*/*;q=0.1
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: http://localhost/faqs/
Cookie: sc_is_visitor_unique=rx11463677.1508953424.EA25315350584FFF2F98A896A7A21A55.14.13.9.8.7.6.1.1.1; SQLiteManager_currentLangue=2
Connection: keep-alive

HTTP/1.1 404 Not Found
Date: Thu, 26 Oct 2017 16:02:25 GMT
Server: Apache/2.2.29 (Unix) mod_fastcgi/2.4.6 mod_wsgi/3.4 Python/2.7.8 PHP/5.6.2 mod_ssl/2.2.29 OpenSSL/0.9.8zh DAV/2 mod_perl/2.0.8 Perl/v5.20.0
Accept-Ranges: bytes
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: text/html
---------------------------------same here-------------------------
http://localhost/faqs/script.js

GET /faqs/script.js HTTP/1.1
Host: localhost
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:56.0) Gecko/20100101 Firefox/56.0
Accept: */*
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: http://localhost/faqs/
Cookie: sc_is_visitor_unique=rx11463677.1508953424.EA25315350584FFF2F98A896A7A21A55.14.13.9.8.7.6.1.1.1; SQLiteManager_currentLangue=2
Connection: keep-alive

HTTP/1.1 404 Not Found
Date: Thu, 26 Oct 2017 16:02:25 GMT
Server: Apache/2.2.29 (Unix) mod_fastcgi/2.4.6 mod_wsgi/3.4 Python/2.7.8 PHP/5.6.2 mod_ssl/2.2.29 OpenSSL/0.9.8zh DAV/2 mod_perl/2.0.8 Perl/v5.20.0
Accept-Ranges: bytes
Keep-Alive: timeout=5, max=96
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: text/html
---------------------------------same here-------------------------
http://localhost/faqs/images/smart-chiro-logo320b.jpg

GET /faqs/images/smart-chiro-logo320b.jpg HTTP/1.1
Host: localhost
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:56.0) Gecko/20100101 Firefox/56.0
Accept: */*
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: http://localhost/faqs/
Cookie: sc_is_visitor_unique=rx11463677.1508953424.EA25315350584FFF2F98A896A7A21A55.14.13.9.8.7.6.1.1.1; SQLiteManager_currentLangue=2
Connection: keep-alive

HTTP/1.1 404 Not Found
Date: Thu, 26 Oct 2017 16:02:25 GMT
Server: Apache/2.2.29 (Unix) mod_fastcgi/2.4.6 mod_wsgi/3.4 Python/2.7.8 PHP/5.6.2 mod_ssl/2.2.29 OpenSSL/0.9.8zh DAV/2 mod_perl/2.0.8 Perl/v5.20.0
Accept-Ranges: bytes
Keep-Alive: timeout=5, max=95
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: text/html
----------------------------------------------------------

[edited by: phranque at 1:48 am (utc) on Oct 27, 2017]
[edit reason] unlinked urls [/edit]

8:05 pm on Oct 26, 2017 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month

joined:Apr 9, 2011
posts:14251
votes: 551


Do you have a text editor (such as TextWrangler, the free version of BBEdit) that can do multi-file RegEx searches?

Every time there is a question in the form “I have no idea why it’s looking for abc” you need to do a multi-file search for all occurrences of abc. Computers do not invent things out of the clear blue sky. They often seem to, but they don’t really.

Also: This forum auto-links all URLs. Since changing to example.com isn't practical, the simplest alternative is to put the entire thing into [ code ] markup, so that instead of
[localhost...]
you see
http://localhost/long-complicated-path
12:18 am on Oct 27, 2017 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month

joined:June 4, 2002
posts: 1830
votes: 3


I use BBedit. If I'm supposed to look for "assets" I can tell you there are none concerned with this website. I never use that term to store images. There is also no folder called faqs. I specify the htdocs folder within MAMP andset up a Multi-File Search in BBedit for:
assets - not found
localhost - not found
localhost/faqs/aascc.css - not found.
localhost/faqs.html not found (even though it's in there but this is the one that reverts to locahost/faq/ and then opens the home page and displays the url as localhost.)
localhost/faqs/ not found. etc.
3:01 am on Oct 27, 2017 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month

joined:Apr 9, 2011
posts:14251
votes: 551


Well, of course you won't find /localhost/, since that is represented by / in the HTML just like example.com would be. The ongoing question is why it expects to find /assets/.

GET /assets/caret2-white.png HTTP/1.1
...
Referer: http://localhost/aascc.css
What, if anything, does aascc.css have to say about caret2-white.png ?

GET /faqs/images/smart-chiro-logo320b.jpg HTTP/1.1
..
Referer: http://localhost/faqs/
Again: what, if anything, does /faqs/ (which I assume physically means /faqs/index.html) have to say about smart-chiro-logo320b.jpg ?

Does the site use any external material--adsense, fonts, third-party scripts--anything like that?
3:57 pm on Oct 27, 2017 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month

joined:June 4, 2002
posts: 1830
votes: 3


My apologies. I found where I had used "assets" in this current menu's css file. I had used this same menu on another site that uses "assets" to store images (the only site out of 100s I've built that uses assets). I missed taking out one of them in the css file. When I ran a multi-file search for "assets" in the htdocs folder it didn't catch it for some reason.

However there is still this other problem.

I ran another live header check on localhost and everything throws a 200 now.

However when I try to type in the localhost/faqs.html page it is still reverting to the home page with a 301.

I tried putting a slash in front of the menu links and that didn't work either.

Is there anything in this htaccess that can be causing it:

ErrorDocument 404 /missing.html
AddHandler server-parsed .html
#
Options +FollowSymLinks +Includes
RewriteEngine on
#
#EXTENSIONLESS URL FIX
RewriteCond %{THE_REQUEST} \.html
RewriteRule \.html$ /%1 [R=301,L]
#
RewriteCond %{REQUEST_URI} !(\.[^./]+)$
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule (.*) /$1.html [L]
#
This 49 message thread spans 2 pages: 49
 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members