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 www.yoursite.com 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?

Setting up a wordpress installation ready for the inevitable upgrade.

All websites have to be updated from time to time. If you read the documentation they tell you to install wordpress in the root directory, which is fine if you are never going to change anything. On the other hand you should be planning for the future.

Start off by creating a folder in the root directory of your hosting package. The name of the directory is irrelevant so choose something that suits you. One word of warning, most will tell you to use something like wordpress. I, on the other hand, would use something else because you can only use it once. Choose something that when you update you can use the next one in the sequence. EG: “January”, “February” or “wordpress_2012”, “wordpress_2013”.

This directory is where you are going to install your wordpress. By setting up your wordpress in this way, in the future when you want to reconfigure your site, all you will have to do is create another folder (the next in the sequence) and install a separate wordpress in the new folder. While you are working on your site or new site you will be able to access it with the following url  http://yoursite.com.au/yourfolder/wp-login.php. Of course you will replace yoursite.com.au with the url of your site and yourfolder with either of the folders your sites are in, depending which on which site you want to login to.

When you are ready to go live with your new site you will only have to change one line in the existing index.php in your root directory and update the .htaccess file and your new site will be live.

Below are the full instructions how to set up your site in this way.

1.    Download and install the latest version of WordPress in a new directory on your web host plan. Eg: “yourfolder_2012”

2.    Add or edit your robots.txt file in your root directory and block access to your new folder because while you are in the setup phase you don’t want search engines to crawl your site.

a.    Add the following to your robots.txt file with each item on its own line.

i.    User-agent: *

ii.    Disallow: /yourfolder/

3.     Log in to your dashboard and install the Maintenance Mode plugin

a.    Search for “maintenance mode” in the plugin installer in your new wordpress site

i.    WordPress> Plugins> Add New>

ii.    Configure the maintenance mode plugin to block access to your new site.

b.    Go to Maintenance Mode settings

i.    Plugins> WP Maintenance Mode> Settings>

ii.    Change Plugin Activate to “true”

iii.    You can set any of the other features you want at the same time.

4.    Each time you want to add content to your new site you will be able to go to

a.    http://yoursite.com.au and click the link and login on the next screen or go directly to

b.    http://yoursite.com.au/yourfolder/wp-login.php and login.

5.    Add your content and code to your site

a.    Test your site, make sure every thing is working the way you want it to.

i.    When everything is working, and not before, move on to the next section.

ii.    Remember test, test, test and test again.