WordPress Performance and Usability

I have created a handful of WordPress websites which are hosted on GoDaddy Managed WP. I did not choose the hosting environment – the customers did. Since GoDaddy will not allow me to use any caching plugins, another solution had to be found to solve performance issues.

I added several lines to .htaccess to force browser caching for various file types, and while this did speed up subsequent page loads, first time visitors were still loading slowly.

Finally I found the solution that cut the time the pages loaded in half. In a blog post on the Canonical SEO website, the author explains the inefficiencies in the default WordPress .htaccess code, and a very simple code replacement.

Voilà!

Find:

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

replace with:

# BEGIN WordPress
RewriteEngine on
#
# Unless you have set a different RewriteBase preceding this
# point, you may delete or comment-out the following
# RewriteBase directive:
RewriteBase /
#
# if this request is for "/" or has already been rewritten to WP
RewriteCond $1 ^(index\.php)?$ [OR]
# or if request is for image, css, or js file
RewriteCond $1 \.(gif|jpg|css|js|ico)$ [NC,OR]
# or if URL resolves to existing file
RewriteCond %{REQUEST_FILENAME} -f [OR]
# or if URL resolves to existing directory
RewriteCond %{REQUEST_FILENAME} -d
# then skip the rewrite to WP
RewriteRule ^(.*)$ - [S=1]
# else rewrite the request to WP
RewriteRule . /index.php [L]
#
# END wordpress