Over the years WordPress has become more and more popular. To put into number, there are about 73,757,043 WordPress powered sites in the world today, half of these hosted by WordPress.com. There is however one tiny problem, WordPress blogs hosted by WordPress.com are hosted on servers specifically setup and optimized to run WordPress, but the self hosted WordPress sites are often hosted on shared hosting packages. So what does this mean? Well simply put, your self hosted WordPress site is sitting on a server that is setup to run a large variety of systems and application, not just one.
In cases like this it is often necessary to do some tweaking and help speed things up a bit. That’s exactly what I am going to cover today, How to Optimize and Speed Up Your WordPress Site in a shared hosting environment.
1: Caching
Caching is one of the more important factors in speeding up your site and also one of the easiest tweaks to implement. WordPress has various good plugins available which serve this purpose perfectly. These plugins will generally generate and serve html pages created from your posts and pages instead of continually running database queries.
Here are the plugins I recommend:
2: Optimize Your Database
WordPress is a data driven application, simply put it uses a database to store all your information and keeping this database in a healthy optimized state is well worth the time and effort. Here are some plugins I recommend;
3: Compress and Combine JS and CSS Files
Compressing JS (Javascript) and CSS files will give a good improvement on your site’s loading time. Compressing the JS and CSS files will decrease your overall page size and thus also improve your page loading times.
If you want to compress everything in go I recommend the WordPress wp minify plugin for combining various JS and CSS files into one file.
Alternatively here are other tools that also handle the job;
- JS compressor:
4: Compress Images
We all love using images in our posts and pages, it adds colour and life, but also adds “weight” to you site and again we have to deal with page loading times. By default WordPress has a built in image cruncher but trust me, it will not hurt getting some more help in to further reduce images size.
For this I recommend using WP Smush IT. You can also make use of CSS Sprite’s.
5: Compress Your Static Content with gZip
A slightly more advanced tactic, but again well worth it is to compress your static content using gZip. The gZip feature should be active by default on any server running Apache. Just add the code below to your .htaccess file and the gZip function will compress all your static content, like images, css, js, xml etc. This in-turn again reduces your page loading times.
# force deflate for mangled headers
# developer.yahoo.com/blogs/ydn/posts/2010/12/pushing-beyond-gzipping/
SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$ ^((gzip|deflate)\s*,?\s*)+|[X~-]{4,13}$ HAVE_Accept-Encoding
RequestHeader append Accept-Encoding “gzip,deflate” env=HAVE_Accept-Encoding
# HTML, TXT, CSS, JavaScript, JSON, XML, HTC:
FilterDeclare COMPRESS
FilterProvider COMPRESS DEFLATE resp=Content-Type $text/html
FilterProvider COMPRESS DEFLATE resp=Content-Type $text/css
FilterProvider COMPRESS DEFLATE resp=Content-Type $text/plain
FilterProvider COMPRESS DEFLATE resp=Content-Type $text/xml
FilterProvider COMPRESS DEFLATE resp=Content-Type $text/x-component
FilterProvider COMPRESS DEFLATE resp=Content-Type $application/javascript
FilterProvider COMPRESS DEFLATE resp=Content-Type $application/json
FilterProvider COMPRESS DEFLATE resp=Content-Type $application/xml
FilterProvider COMPRESS DEFLATE resp=Content-Type $application/xhtml+xml
FilterProvider COMPRESS DEFLATE resp=Content-Type $application/rss+xml
FilterProvider COMPRESS DEFLATE resp=Content-Type $application/atom+xml
FilterProvider COMPRESS DEFLATE resp=Content-Type $application/vnd.ms-fontobject
FilterProvider COMPRESS DEFLATE resp=Content-Type $image/svg+xml
FilterProvider COMPRESS DEFLATE resp=Content-Type $application/x-font-ttf
FilterProvider COMPRESS DEFLATE resp=Content-Type $font/opentype
FilterChain COMPRESS
FilterProtocol COMPRESS DEFLATE change=yes;byteranges=no
# Legacy versions of Apache
AddOutputFilterByType DEFLATE text/html text/plain text/css application/json
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE text/xml application/xml text/x-component
AddOutputFilterByType DEFLATE application/xhtml+xml application/rss+xml application/atom+xml
AddOutputFilterByType DEFLATE image/svg+xml application/vnd.ms-fontobject application/x-font-ttf font/opentype

Just wondering I see the htaccess file on the server says the following:
# Don’t compress images
SetEnvIfNoCase Request_URI .(?:gif|jpe?g|png)$ no-gzip dont-vary
Does that have to be deleted and the code above inserted?
Good Day Gary,
My apologies for the late reply. You do not need to delete the code in the .htaccess file. You can simply just insert the mentioned in the post and everything will be handled accordingly.