Gateway for IT Experts and Tech Geeks

How to Speedup WordPress Site 90% Without Plugin?

If you test you site speed with google PageSpeed or GTmetrix, you will see some statistics about page speed or Yslow score. You most probably want to see a high score. this article is all about how to speedup WordPress site up to 90% with simple tricks. Though there are many plugins like W3 Total Cache or Gzip Ninja, this tutorial will show you the trick without those plugins. So, all you need is to have access to your site cpanel.

What are the Most Common Speed Problems?

There some problems that page speed tester websites mention with testing our site. Here are list of them and how to solve them.

  • How to solve: Defer parsing of JavaScript?
  • How to solve:Remove query strings from static resources?
  • How to solve: Specify a cache validator?
  • How to solve: Enable gzip compression?
  • How to solve: Leverage browser caching?
  • How to solve: Enable Keep-Alive?
  • How to solve: Specify a cache validator?

and more…

We are going to use GTmertix for testing our site speed, you can use any other speed tester as you want.

Speedup WordPress site

To remove query strings from static resources in WordPress site, simply past the following code in your theme function.php file. If you are not a developer, call someone who know’s about theme development in WordPress to do this step for you.

function _remove_script_version( $src ){ 
$parts = explode( '?', $src ); 	
return $parts[0]; 
add_filter( 'script_loader_src', '_remove_script_version', 15, 1 ); 
add_filter( 'style_loader_src', '_remove_script_version', 15, 1 );


To solve others problems, just add the following code in you .htaccess file. The htaccess file must be in the root directory of you site. (make sure you talk a copy of you htaccess before adding this code).

Note: There might be some lines in your htaccess file which is already generated by WordPress. You can add this code at the end of that code. But I recommend to replace all of that with the following code. It’s standard code plus speedup WordPress site code.

# 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]
Header set Connection keep-alive

# Enable Compression.
<IfModule mod_deflate.c>
  AddOutputFilterByType DEFLATE application/javascript
  AddOutputFilterByType DEFLATE application/rss+xml
  AddOutputFilterByType DEFLATE application/
  AddOutputFilterByType DEFLATE application/x-font
  AddOutputFilterByType DEFLATE application/x-font-opentype
  AddOutputFilterByType DEFLATE application/x-font-otf
  AddOutputFilterByType DEFLATE application/x-font-truetype
  AddOutputFilterByType DEFLATE application/x-font-ttf
  AddOutputFilterByType DEFLATE application/x-javascript
  AddOutputFilterByType DEFLATE application/xhtml+xml
  AddOutputFilterByType DEFLATE application/xml
  AddOutputFilterByType DEFLATE font/opentype
  AddOutputFilterByType DEFLATE font/otf
  AddOutputFilterByType DEFLATE font/ttf
  AddOutputFilterByType DEFLATE image/svg+xml
  AddOutputFilterByType DEFLATE image/x-icon
  AddOutputFilterByType DEFLATE text/css
  AddOutputFilterByType DEFLATE text/html
  AddOutputFilterByType DEFLATE text/javascript
  AddOutputFilterByType DEFLATE text/plain

<IfModule mod_gzip.c>
  mod_gzip_on Yes
  mod_gzip_dechunk Yes
  mod_gzip_item_include file .(html?|txt|css|js|php|pl)$
  mod_gzip_item_include handler ^cgi-script$
  mod_gzip_item_include mime ^text/.*
  mod_gzip_item_include mime ^application/x-javascript.*
  mod_gzip_item_exclude mime ^image/.*
  mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*

# Leverage Browser Caching.

<IfModule mod_expires.c>
  ExpiresActive On
  ExpiresByType image/jpg "access 1 year"
  ExpiresByType image/jpeg "access 1 year"
  ExpiresByType image/gif "access 1 year"
  ExpiresByType image/png "access 1 year"
  ExpiresByType text/css "access 1 month"
  ExpiresByType text/html "access 1 month"
  ExpiresByType application/pdf "access 1 month"
  ExpiresByType text/x-javascript "access 1 month"
  ExpiresByType application/x-shockwave-flash "access 1 month"
  ExpiresByType image/x-icon "access 1 year"
  ExpiresDefault "access 1 month"

<IfModule mod_headers.c>
  <filesmatch "\.(ico|flv|jpg|jpeg|png|gif|css|swf)$">
  Header set Cache-Control "max-age=2678400, public"
  <filesmatch "\.(html|htm)$">
  Header set Cache-Control "max-age=7200, private, must-revalidate"
  <filesmatch "\.(pdf)$">
  Header set Cache-Control "max-age=86400, public"
  <filesmatch "\.(js)$">
  Header set Cache-Control "max-age=2678400, private"



Now you site must be in a group of speed tester site. We hope it helped you and, if you have any question or any problem, feel free to comment it below. 🙂

  1. Airf says

    Thanks, it just work perfectly and I would like to know more about how to improve my website.

    Thanks agin

  2. Hujjat Nazari says

    You’re welcome dear Arif 🙂

  3. Unika Infocom says

    Currently I’m using W3 Total Cache for website speedup is it possible to speedup my website without using that plugin ? If i will do it using your suggestion is it do the same thing that W3 Total Cache do ?

  4. Hujjat Nazari says

    @Unika Infocom.

    You can use w3 Total Cache plugins and it will make your site faster. But some it can’t fix Enable Keep-Alive, Defer parsing of JavaScript and some more. Besides that, the more plugins you use, the lower your site gets.

    These methods are without a plugin and don’t have any drawback.

  5. kishore says

    Thanks for the great support but my site has same speed issue I follow your all steps…

Leave A Reply

Your email address will not be published.