Recently I migrated all my websites from a dedicated server to  Liquid Web Managed WordPress hosting. Most of my websites are now WordPress installations using either Elegant Themes DIVI or StudioPress themes. I decided that as part of the migration with the help of Liquid Web support I would convert all my sites to use SSL/HTTPS. It turned out to be quite the endeavor. After the conversion the standard http version of the sites looked and worked fine while using the https prefix the sites were a mess. The content was there but it was not displayed properly. After a bit of troubleshooting we decided to rename the .htaccess file so it would be ignored by WordPress. A quick page refresh and the site appeared as it should. Problem temporarily solved.

htaccess WordPress

htaccess Default WordPress

.htaccess WordPress

When WordPress is installed a default WordPress htaccess is generated and placed in the site root. Life is good. However as time goes by it’s possible for many plugins to write to the .htaccess file. Naturally that also means errors can be introduced to the .htaccess file. If that’s not bad enough there is the human factor. The .htaccess can serve many purposes like blocking or redirecting ip addresses, disabling hot linking of images or a host of any other useful functions. Upon review my htaccess was filled with outdated and irrelevant code. Something in my WordPress .htaccess file was causing my the DIVI and StudioPress themes to break and not display correctly. Rather than waste time trying to find the exact culprit I decided it would be easier to start with a new default WordPress .htaccess file. Directions below

Click for WordPress htaccess File Download – upload to your site root with an ftp client. rename the file to .htaccess

How to Create a WordPress Default .htaccess File

A .htaccess file is a distributed configuration file that’s present not just in WordPress, but in all Apache web hostings. .htaccess files can be used to boost your website’s performance, security and usability. A few features that you can enable or disable using a .htaccess file include server signature, file caching, URL redirection, password protection and custom error pages.

WordPress installations may or may not contain the .htaccess file in the root directory, depending on your permalink structure; while a default ‘ugly’ permalink structure comes sans .htaccess, a pretty permalink structure auto creates a .htaccess file in your WordPress. In case you’re using default WordPress settings (read an ugly permalink structure), it is highly advisable to change it to a pretty permalink structure. Now assuming that you want to enable default pretty permalinks, create a new notepad file and rename it to .htaccess (not .htaccess.txt). Include the following basic code in the file:

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

Save the changes and upload the file to your WordPress root directory using FTP.

Protect your .htaccess File

To protect your .htaccess file from external users and to tighten website security, it is recommended to add the following code to the .htaccess file:

<Files .htaccess>
order allow,deny
deny from all

While making any modification to your .htaccess file, it is important to remember that even a tiny error in the .htaccess file can cause a major issue on your website, so much so you might even end up disabling your entire server with one simple typo. Hence, it is advisable to make a backup of your .htaccess file before making any changes to it. This way, if something goes wrong, you can always revert to the backup version of the file.