Why did my Wordpress .htaccess file change or become corrupt?
July 6, 2009 3:02 PM   Subscribe

I have a Wordpress blog (v2.8) that sudden started displaying an Internal Server Error message. My host (Dreamhost) found a problem with my .htaccess file. I didn't do anything to cause the problem so I am wondering what happened and if it could happen again. I "fixed" it by replacing it with one that does nothing. I am also wondering what the file should contain. I know what its purpose is, but not much more than that.

Here's the broken file:

# BEGIN WordPress

# END WordPress
ne On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

# BEGIN WordPress


# END WordPress

I suspect that the 4th line should say "Rewrite Engine On".

I do have a fair number of active plug-ins, but the configuration has been stable for awhile.
posted by 14580 to Computers & Internet (4 answers total) 1 user marked this as a favorite
 
Best answer: Judging by my experiences with Dreamhost and Wordpress: they don't give it the amount of memory it needs. So an internal server error most often means that one process consumed too much of whatever resources they reserved for it.

I replaced almost all of the plugins on my sites with hard code, which helped a lot.

And, it may be possible to give Wordpress more memory, by using this trick.
posted by ijsbrand at 3:11 PM on July 6, 2009


Best answer: O, and my .htaccess is:
# BEGIN WordPress

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]


# END WordPress

posted by ijsbrand at 3:14 PM on July 6, 2009 [1 favorite]


Best answer: The slightest syntax error in your htaccess file and your entire website will start throwing those "internal server error" messages.

The "ne On" line is definitely a syntax error that would cause exactly that problem.

My guess is, somehow your htaccess file became corrupted. Any number of different ways that could happen.

If you change the broken line to
RewriteEngine On
or just change your htaccess file to be like ljsbrand's, all should be well again.
posted by flug at 3:31 PM on July 6, 2009 [1 favorite]


In case you're wondering what that .htaccess file does normally, it checks that the URL requested exists (i.e. is a file or directory), and if it doesn't, it redirects back to the /index.php page.
As already answered, it was corrupted somehow; either it got partially overwritten when you were updating wordpress, or the hosting provider had a minor disk error, or any of a hundred different possible causes. You've got good offsite regular backups, yes?

Generally, a .htaccess file is a way of adding apache server directives to a particular folder path; especially when in a shared hosting environment, and they don't want you messing with the master configuration file.

The .htaccess file can be used for security permissions (adding a password), redirecting requests to someplace else, doing so based upon certain rules (i.e. such as your rewrite example) or pretty much anything else you can put in the apache config.
posted by ArkhanJG at 1:25 AM on July 7, 2009


« Older Disco Inferno   |   USA Mailbox for magazines? Newer »
This thread is closed to new comments.