There are so many ways to speed up your WordPress site but many of them involve installing this plugin or that one, having to set it all up and hoping that it doesn’t cause a conflict somewhere else down the line.
But did you know that you can optimize WordPress to a certain extent without having to install a plugin? I wouldn’t recommend this for beginners because it involves editing the .htaccess file, wp-config and php.ini file.
Step 1 – Back up your website
Before you make any changes to any file or install any plugin, you should always back your website up. If things go wrong and you haven’t done this, you stand a good chance of losing the lot.
Step 2 – Use Google PageSpeed Insights to See Your Current Page Speed Score
Self-explanatory, do write down the pertinent information form this so you can compare it later
Step 3 – Open .htaccess
You will need an FTP client to do this as the file is in your website’s root directory. You need to enable browser caching and once you have done that, save it and then check the front-end of your website to make sure it all still works.
What we are doing is enabling Expire Headers so insert the following code into the file:
# BEGIN Expire headers
ExpiresDefault “access plus 5 seconds”
ExpiresByType image/x-icon “access plus 2592000 seconds”
ExpiresByType image/jpeg “access plus 2592000 seconds”
ExpiresByType image/png “access plus 2592000 seconds”
ExpiresByType image/gif “access plus 2592000 seconds”
ExpiresByType application/x-shockwave-flash “access plus 2592000 seconds”
ExpiresByType text/css “access plus 604800 seconds”
ExpiresByType text/html “access plus 600 seconds”
ExpiresByType application/xhtml+xml “access plus 600 seconds”
# END Expire headers
# BEGIN Cache-Control Headers
Header set Cache-Control “public”
Header set Cache-Control “public”
Header set Cache-Control “private”
Header set Cache-Control “private, must-revalidate”
# END Cache-Control Headers
Step 4 – Limit the Number of Post Revisions
WordPress, by default, stores every change made to your posts and pages and having too many of these can cause a serious slow-down in your website. In the root directory of your WordPress installation, find the wp-config.php file and add this code:
/**Limit Post Revisions**/
define( ‘WP_POST_REVISIONS’, 3);
Or, you could set your site so it stores no post revisions, in which case, your code would be:
define( ‘WP_POST_REVISIONS’, false);
Step 5 – Find Your PHP.INI file
The location of this will depend on your host so have a look in the host control panel for something like CGI PHP Scripts or just ask your host where it is. When you have it, you are going to enable GZip with the following code.
First, find this line in the file:
zlib.output_compression = Off
Change Off to On
Now look for this line:
zlib.output_compression_level = 6
Most likely your level number will be different so set it to 6. Save and check your website front-end – you should already be seeing a significant increase in speed.
Step 6 – Retest on PageSpeed Insights
How does your new score compare to the old one?
Seriously, you can spend days, weeks trying to speed up your website with all sorts of tools and, in all honesty you should do it. But for now, to see an immediate increase, these steps will work, speeding up your WordPress website quite considerably, inside of about 10 minutes and with no plugins in site.