≡ Menu

Tips for fixing a broken .HtAccess File in WordPress- make your website loads, and looks correctly

A broken .HtAccess file in your WordPress blog folder at the main root level can make your blog template and design not load correctly, or make your blog not readable or usable where all your custom designs, images, etc are gone, and the sidebar is at the bottom or top of your blog, and you only see unformatted text. A corrupt .HtAccess file can also make your blog can’t upgrade, deactivate, or uninstall plug-ins, and themes for WordPress or can’t go to pages and posts on your blog which can be annoying to your readers who now only see a blank screen on your website.

The simplest way to fix a broken .HtAccess file in WordPress is to delete the broken .htAcess file, and upload a backup of an old .htAccess file which you previously back up, and your blog’s .HtAccess file should be fine again afterwards.

Sometimes, you can use a .HtAccess file from another blog, and upload the file to your broken blog, and it would work if they are both installed on the root of a domain like example.com or a path domain with the exact same name like example.com/blog .

Clear your web browser history, temporary internet files, etc before you reload your blog’s homepage, posts, and pages since you may still be using the old CSS, and HtAccess files stored in your web browsers temporary internet files folder on your computer. deleting your temporary internet files will show how your blog will look to people visiting your site.

If you have a WordPress Caching plug-in like W3 Total Cache, WP Super Cache, clear the cache files and folders, so you see the latest version of the changes you made to your blog, and not the cached version from a few minutes or hours a go.

If you never backed up your .HtAccess file for your WordPress blog, you can rebuild your .Htaccess.

Backup your blog’s database, and WordPress folder to your desktop before you begin the steps I mention below, so if something goes wrong, you can reupload your WordPress folder from backups, and database if you messed up WordPress when uninstalling WordPress plug-ins which is very rare in my experience.

First, uninstall Plug-ins like W3 Total Cache, WP-SuperCache, Bullet Proof Security, and other 3rd party plug-ins which uses your .HTAccess to add custom rules for a plug-in to work. Now visit your blog’s homepage, post, and pages to see if everything is fine.

Auto-updating plug-ins like some Security Plug-ins sometimes can suddenly break your website by automatically adding custom text to the .HTAccess file when it updates the plug-in. Using a text editor to remove the custom text which the security plug-in added, and saving the .HTAccess file to the root folder of WordPress sometimes fixes WordPress, and let you see your website instead of a blank page, and allows you to login to WP-Admin dashboard again.

If your blog is still not working after restoring from an older version of your .htAccess file, and you can login to your WordPress Dashboard, you should go to your Settings Menu in your WordPress WP-Admin Dashboard, and then click on the Permalinks sub section, and click save changes to rebuild the .HTAccess file.

The Permalink settings will add a few lines of code to your WordPress .HtAccess file on the Root of your WordPress folder.

The lines would look like

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /wordpress/
RewriteRule ^index\.php$ – [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /wordpress/index.php [L]
</IfModule>

in your .HtAccess file.

If your blogs path is /blog/ instead of WordPress then rewritebase would be /blog/ , or if your blog is installed on the root level on your domain your rewritebase would be / or something different.

Your WordPress .HtAccess has to be writeable. You may need to change the CHMOD Permissions with an FTP Client to change the .HTAccess file permission in your WordPress Folder to 755 to make it writeable in WordPress.

Now, your blog’s .HtAccess folder should be working again.

You can reinstall the latest versions of your plug-ins like WP Bullet Proff Security, W3 Total Cache, WP Super Cache which uses the .HTAccess files to work properly, or find other plug-ins which work with your WordPress blog on your web hosting server.

Sometimes, disabling certain features inside of Plug-ins will make your site look correctly without the need to re-generate the .HtAccsess file. I remember when I used W3 Total Cache, the CSS Minify feature messed up the CSS and design of my blog until I disable the Minify feature on W3 Total Cache. Now I just use WP Super Cache instead of W3 Total Cache because it is easier to use.

It is important to read the Plug-in instructions before you install them. Bullet Proof Security requires you to copy the code from your current .HtAccess file in your root to the secure.htAccess file in BPS, and save the changes. Be sure to back up your .HTAccess file before you activate the secure.HtAccess file in BPS, so you can quickly restore your blog if you have problems after activating secure.htaccess mode.

If restoring your .HtAccess does not work, your blog may be broken. You can try uninstalling all your WordPress plug-ins, and using the default TwentyEleven WordPress Template for WordPress, and seeing if it is a plug-in or custom theme which is making WordPress not work well.

You can also reinstall WordPress by going to the Dashboard Menu then going to the Updates Menu item, and click on reinstall WordPress button. You should backup your database and WordPress folder just in case something goes wrong during the WordPress re-install process. But, it is very rare for WordPress to be corrupt during WordPress Reinstall in my experience.

Also, check to see if your WordPress Blog template file is compatible with the latest version or WordPress if it isn’t download and update the latest version of your blog template, download and install an compatible template from WordPress.org, or buy a template from a Theme Maker. I recommend the Theseis WordPress Theme since it is one of the most easy to use themes for WordPress. Thesis is the theme which this blog is using. I’m an affiliate, so I get a commission when you buy the theme from the link above, or from the link at the very bottom of the blog.

You can also ask your web hosting company or WordPress Forums for help if everything else fails. Many web hosting companies also has a way for you to restore your files to a previous backup which it took when your website is not working well, or at all. You may lose some posts, but you’ll get your blog back to normal by restoring from your Web hosting back up files for your websites. If your web hosting account does not make backups, I recommend you regularly backup your files and database files on your website on a monthly, weekly, or daily basis. Also, you should backup your website  on a regular basis just in case your web hosting company backup files fail you.

It seems that WordPress Plug-ins, and not using WordPress plug-ins properly seem to be the main reason of a corrupt WordPress .HtAccess text file on my WordPress blog which breaks WordPress.

I also never had many .htaccess problems with Joomla, Drupal, and phpBB3 website software. This problem seem to affect WordPress more in my case.

I hope this Tutorial helps you fix or know how to fix a broken .HtAccess file in WordPress

One of the advantages of an HTML site which you make with Notepad, Dreamweaver, Frontpage, or Coffee Cup HTML website builders is a .HtAccess file is not needed for a HTML based site to run properly like WordPress, and many other free PHP blog and website software. You can also test the website on your computer before uploading it to your web hosting account.

4 comments… add one
  • Joseph December 14, 2011, 5:14 am

    I am not familiar with this issue.. this seem a good info in newbie like me. great post.

  • Johnson Yip December 14, 2011, 11:18 pm

    Glad you found my post useful.

    This problem is very rare if you don’t have any plug-ins like caching, and security plugins for WordPress which rely on the .HTAccess file to work properly.

    Hopefully, you never get this issue since it is awful to fix if you do not know how to use a FTP client, forgot your FTP client login name and password, or you don’t have an older version of your .HtAccess file to replace your broken file.

  • David Britt December 18, 2011, 7:06 am

    I experiencing this issue several times because I’m not really good on fixing my site. I have no idea that .HtAccess File is the problem..thanks for heads-up!

  • Johnson Yip December 18, 2011, 2:18 pm

    Indeed, the .HtAccess files can be a problem preventing your blog from displaying properly since it is one of the files which plug-ins, and the web master can edit which can cause page not found 404 errors, and forbidden 403 errors when the HTAccess is broken by a plug-in or the webmaster.

Leave a Comment