Uncategorized

Why does WordPress rewrite .htaccess on its own ?

Wierd title huh ! Its true. This is the second time WordPress has automatically overwritten .htaccess file with its own blank version. Once this happens you can visit your main page but trying to open any post page will result in a 404 error. 404-errorI spent the whole day wondering why my visitors were so less, kept sending mails and tickets to my hosting company about it too. Finally realized that this was due to a combination of site downtime and the 404 error for posts. Having gone through this error twice on this blog before and once for my Mom’s blog, I immediately corrected it with the fix I will share below. Anyways my hosting is was also bad, too many downtimes on their part.

Fix for WordPress 404 error on posts but homepage opens

  1. Login to your WordPress Admin area (http://yourdomain.com/wp-admin)
  2. On the right menu click on Settings
  3. Now click on Permalinks
  4. If you are using a custom permalink copy it
  5. Change the permalinks to a different type and save
  6. Change the permalinks back to the old setting
  7. Voila your WordPress posts are working again !

I have setup a post page for monitoring on Montastic. Should save me a lot of trouble the next time this happens. So people lets hear about some good cheap hosts !




10 Comments

  1. January 21, 2012 at 8:21 am

    Brian

    Thanks for writing about this. I had two support tickets open all day and no one could figure this out. I opened up the .htaccess file and it had no WordPress components in it. Then I added them in and everything worked out just fine! This saved me a ton of hassle.

  2. April 18, 2010 at 10:36 pm

    Alfred

    Thanks for dropping your comments alaJoAnn.

    Knowing that I was able to help someone makes my day :D

  3. April 18, 2010 at 11:03 am

    alaJoAnn

    That just happened to me, with all my posts redirecting to the home page. Luckily I found your fix. I will sleep tonight. Thank you!

  4. August 5, 2009 at 8:47 pm

    Newt

    We’re hosted at Bluehost but we are having the almost identical problem: every time we fix the .htaccess file, WP rewrites it a few days later: and then the site crashes with a 505 error. It’s like WP is committing suicide!

  5. July 28, 2009 at 2:59 am

    Alfred

    Update since the comment bought up the topic

    I found out that it was the fault of my old webhost (netwayweb/unitech. For some reason the .htaccess would be reset by the host. Finally changed over to bluehost and never had the problem since.

    Changing the permalink uses the WordPress engine to rewrite the htaccess file ;)
    thats the easy solution, you could write htaccess yourself if it was blank and you know how to..

  6. July 28, 2009 at 1:03 am

    Modern Technologies

    WordPress have mod rewrite module which make blog post URL with editable from admin instead of post ID which is very important for Search Engine Ranking but your problem seems strange to solve by changing permalink. Maybe you used something special character in permalink which breaks the URL anyhow.

  7. July 12, 2009 at 7:06 pm

    Strictly Online Biz

    So far so good, I haven’t had any problem accessing your site at all. It loads pretty fast in my opinion.

  8. July 8, 2009 at 10:56 am

    Juscelino M. Acevedo

    I was in a similar situation as far as hosting, and I recently moved both of my blogs over to Host Gator (http://www.hostgator.com). So far I have no regrets, but like I stated, this is a recent change so it too soon to judge. Price is good though.
    .-= Juscelino M. Acevedo´s last blog ..Weekly Recap =-.

  9. July 8, 2009 at 7:22 am

    Tilføj link

    Nice tricks…

    Special the one about WordPress 404 error…. I looked it up at my own blogs, and I have learned something here.

  10. July 8, 2009 at 5:42 am

    Alfred

    On a sidenote, ProjectWonderful kept sending me suspension notices on ad boxes due to downtimes. Sent them a mail and got replied within 30 min !!! Damn if only all networks had service like that.

Comments are closed.