My site “disapeared” a month or so back, but after I implemented my backup I started getting errors. The htaccess didnt survive the backup and I had to reconstruct it all over again.
I have a 301 to direct to the non-www version of the site… but in google webmaster tools I get notices like this.
Certainly: Your .htaccess is either not being read or its “301” is incorrect. You’ll actually have to show your code for us to have a better chance to help, though.
No problem … except with the absurd .htaccess file you’re employing!
First, realize that EVERY .htaccess file in the path must be read, parsed and executed (if needed) for EVERY file request. Having such a long .htaccess means that you’re wasting an immense amount of time/CPU cycles to access EVERY file. To make matters worse, you’re also making MULTIPLE <IfModule> tests every time, too. This is so bad that I’ve got a Standard Rant just for that:
[rant #4][indent]The definition of an idiot is someone who repeatedly does the same thing expecting a different result. Asking Apache to confirm the existence of ANY module with an <IfModule> … </IfModule> wrapper is the same thing in the webmaster world. DON’T BE AN IDIOT! If you don’t know whether a module is enabled, run the test ONCE then REMOVE the wrapper as it is EXTREMELY wasteful of Apache’s resources (and should NEVER be allowed on a shared server).[/indent][/rant 4]
As for your mod_rewrite code, please use the code wrapper (so it’s included in a quoted reply):
“If not a trailing / or containing a dot character (???), add a trailing /.” WHY? IMHO, trailing / is unforgiveable (unless it’s a directory) because it changes the directory level for relative links within the served file.
lol… I think its hilarious you have standardized rants that you keep handy.
Im not a web developer, I just wanted to make a little site to help out Sailors and others. The reason I tried the trailing slash because I was wondering why the link in the original post was going to the 404 page instead of the non-www page and the only difference I saw in the url was the trailing slash… so I thought maybe that was the problem… seems I was wrong.
As far as the absurd htaccess file, I simply used the file that came with the html 5 boilerplate and went from there. Obviously, they are smarter than I so I left it up to them.
With that out of the way, I tried to implement the code you gave me and my problem still exists.
Seems I have a lot of learning to do with this htaccess stuff.
Well, I was a Moderator and Team Leader here for a LOoooonnnNGGG time so I had to do that because I was answering the same questions over and over … FWIW, I use AutoHotKey and merely type in a code for a piece of text, ergo, my standard rants are easy - if I can remember which number goes with which problem area!
IMHO, wildly using trailing slashes is extremely bad - and it’ll bite your behind if you’re not really careful! My recommendation is to use /'s as they’re intended, i.e., to denote directories.
The boilerplate you used was, well, absurd. My Standard Rant #4 was generated because WordPress started using the <IfModule> wrapper to avoid being plagued by complaints that the .htaccess they installed crippled websites (which didn’t have mod_rewrite installed). Too bad they didn’t add a WARNING statement to say how abusive it is on a server. Your boilerplate, however, went overboard in a big way and the creators should be excluded from every shared server (including VPS’s) for their stupidity.
Sorry, the code I gave you was merely parroting back your code and commenting on the “errors” therein. It was left to you as an exercise to clean it up. I learned long ago not to code for “script kiddies” so I really limit my corrections to comments the first time around. When you update your code, I’ll be happy to help you to make it work.
In case I hadn’t recommended it before, you might benefit from reading the mod_rewrite tutorial linked in my signature as it contains explanations and sample code. It’s helped may members and should help you, too (yes, another AutoHotKey entry albeit not a rant).