I was messing with the hotlink protection in CPanel, and just toggled it on and off, unfortunately this broke the permalinks in wordpress. Specifically it removed the line:
RewriteEngine On
In .htaccess
Took me a while to track down.
With wp-supercache, the mod_rewrite part of your .htaccess should look like:
<IfModule mod_rewrite.c> # BEGIN WordPress RewriteEngine On RewriteBase / #RewriteCond %{QUERY_STRING} !.*s=.* #RewriteCond %{HTTP_COOKIE} !^.*comment_author_.*$ #RewriteCond %{HTTP_COOKIE} !^.*wordpress.*$ #RewriteCond %{HTTP_COOKIE} !^.*wp-postpass_.*$ #RewriteCond %{HTTP:Accept-Encoding} gzip #RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/supercache/%{HTTP_HOST}/$1/index.html.gz -f #RewriteRule ^(.*) /wp-content/cache/supercache/%{HTTP_HOST}/$1/index.html.gz [L] #RewriteCond %{QUERY_STRING} !.*s=.* #RewriteCond %{HTTP_COOKIE} !^.*comment_author_.*$ #RewriteCond %{HTTP_COOKIE} !^.*wordpress.*$ #RewriteCond %{HTTP_COOKIE} !^.*wp-postpass_.*$ #RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/supercache/%{HTTP_HOST}/$1/index.html -f #RewriteRule ^(.*) /wp-content/cache/supercache/%{HTTP_HOST}/$1/index.html [L] # RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] # END WordPress </IfModule>
In my case the “RewriteEngine On” was missing, causing individual pages not to work, but the main page worked fine, so I did not notice.
I don’t use Cpanel – I use Plesk on my web server.
I had a similar issue once whne I was trying to modify my .htaccess file to set up a 301 re-direct.
That’s when I learned about the Apache mod_rewrite and that it has to be enabled to make any changes to the .htaccess.
Thanks for your info!
ohh.. thanks a lot. I have had this problem myself, but couldn’t figure it out.
Thanks for pointing out the code. I too like to play, and often end up breaking stuff!
How are you liking WP2.7? It was just released, and they are already starting on 2.8…
You know, I had a problem like this once, and the guys over at Hostgator helped me out. Ive been very fortunate to have them to help me out and get me out of the messes I get into every so often!
Do you think the “RewriteEngine On” missing will cause any problems down the line? It may not be something that you notice right away.
Agree with Sandy. Hostgator has helped me get out of this problem and many others with wordpress.
Problems like that drive me crazy. I had a template problem,while my main index looked the same, the page posts were all messed up. I rarely check those, finally when I did, I freaked. I think it was messed up for 2 months!
Yeah I had a similar problem but hostgator helped me out. Two months is a crazy time to deal with a problem like that, mine was done in just a couple days.
What’s all the lines commented out?
Thanks so much for putting this up – it’s just solved a major headache of mine!
yikes. that looks like a lot of work. Better that I don’t touch those features in cpanel that I’m now aware of. Don’t wanna brake my wordpress cause I probably don’t know how to fix it or search for the bug.
One thing about cpanel is that it writes to .htaccess file if you change certain settings, configurations, or extras using cpanel. Sometimes it messes up and doesn’t write to .htaccess right or will even overwrite what you have there. If you are comfortable with it, I would manually edit the .htaccess file to apply changes rather than use cpanel. If you are not comfortable with it. Download your .htaccess file first, then make the changes with cpanel. If it messes up you can simply upload the original/before the changes back. Or compare the differences to see what the problem might be.
Seen WP2.8 yet? I just updated and it has a pretty nice interface. Only problem is it has a bug in how it reads shortcode, so my wp columns plugin is completely messed up. Now I have to go through and add spaces in the shortcode because 2.8 can’t read it otherwise…stupid coding issues…
is this working with the new wordpress release ?
i dont understand much from mod rewrite.
It’s not really a WordPress bug, it’s a problem with CPanel.
Yes well I agree with Mick West, it seems to be a CPANEL bug.
I think they fixed this problem in the most recent version of CPanel. Might be me but it looks like they dropped the hotlink function entirely.
I had this problem before. I turned on hotlink protection recently as I had some issues and was afraid to turn it off (still am) even though ti appears to be working. Before I had the same issue. All pages but my main page vanished. No good luck with any of the WP plugins to stop HLing. Messed my site up even worse usually.
Thanks
Bill