Corrupt .htaccess file and Internal Server Error

Ok So you are working on your wordpress site. Making changes and updating your site when all of a sudden you get…

Internal Server Error

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, [no address given] and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.
Apache/2.2.18 (Ubuntu) Server at Port 80

Before the panic sets in go to your .htaccess file and check that all is as it should be. For example when this happened to me last time this is what my file looked like.

Corrupt .htaccess

# BEGIN # BEGIN Wo<IfModul<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ – [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfM# END W
# END WordPress

notice the first and second last lines

# BEGIN # BEGIN Wo<IfModul<IfModule mod_rewrite.c>

</IfM# END W

well this means that during the last save your .htaccess file has become corrupt. There are a plethora of reasons why the .htaccess can become corrupt for example the .htaccess above was corrupted when my internet connection dropped out for a few seconds while the file was being written.

So how to fix this problem. You could try correcting the problem lines. If you know what the correct lines should look like. If you don’t know what the corrupted lines should look like you can delete the corrupted .htaccess file all together. Then in the wordpress dashboard open either a post or a page and save it, you don’t even need to make any changes and your .htaccess file will be re written. Simple huh?