Speedup WordPress Tip#1

Guide to Faster WordPress Load times

TIP #1 : Modify your .htaccess file to filter out the non wordpress related files, such as css, gif, png, so your WordPress’s index file isn’t processing each file.

I’ve seen a lot of “Top 10 or 13 lists” to speed up WordPress. I’m going to post some real examples for increasing WordPress’s speed to squeeze every drop out of it. After I run through the first 5 tips, next week I’ll post them collectivity in a top list with links to each post, that way each one can get the detail it deserves.

This is an easy trick to reduce loading time on WordPress, esp. on shared servers. What this is is a complete overhaul of the default .htaccess file that comes with wordpress. This one is revved up by skipping the rewrite for all images and css files, as they SHOULDN’T be rewritten anyway, and this way avoids loops which waste time on every call to an image. Sites that see huge gains from this are sites with a lot of images or css files, on a shared host. Of course, imagless, sites on dedicated host won’t notice a difference, but that is a rare case indeed.

So this isn’t really the #1 tip, it’s just the first in a series of tips. You should do all that you can to decrease the load time of your pages, as I suspect Google’s page rank takes it into account.

Here’s the code you need to put in your .htaccess file, it was written by someone on http://www.webmasterworld.com/apache/4053973.htm post number #:4054591 He states the reasons why he thinks WordPress should make this their default htaccess file, but until then you’ll need to do this manually, and possibly after WordPress updates.

# 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|ico|css|js)$ [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

Another .htaccess tip is to Extend the expiry on static content.

An Expires header is a way to specify a time far enough in the future so that the clients (browsers) don’t have to re-download any static content (such as css file, javascript and images). This can cut your load time significantly for your regular users.

You need to copy and paste the following code in the TOP of your root .htaccess file:

ExpiresActive On
ExpiresByType image/gif A2592000
ExpiresByType image/png A2592000
ExpiresByType image/jpg A2592000
ExpiresByType image/jpeg A2592000


  1. Jason March 8, 2010 at 2:52 am

    I agree, I noticed in the new version of WordPress Multi User, they changed the htaccess considerably.

    I'm glad it helped! It made a major difference on my blogs, where they load many images. This tip works well as a supplement to caching!

  2. kaiser March 7, 2010 at 9:17 pm

    This should go into the default configuration of wordpress, indeed. It speeds up loading times significantly on my blog(s). Thanks for the tip!

Leave a reply

Skip to toolbar