Boost your wordpress site using htaccess optimization methods
October 21, 2016 Comments 0 329 Views

Boost your wordpress site using htaccess optimization methods

You can optmize your wordpress website using htaccess file techniques. Only enabling the Compression, Setting up Header Expiry, Setting Header Cache controls can do wonders with your page loading speed. Below is the explanation of each section which can be added to htaccess to get eye catching result for your websites.

Speed up wordpress site using htaccess optimization techniques to increase web performance.

Website performance are getting more attention from web developers and website owners, because it is important and is one of the hottest topics in web development and search engine optimization.

First and foremost, loading speed is more than a feature. Speed of your website is the most important feature for the customers. If your website or blog is slow then it will get hard for the visitors to stay on your page longer and you will get too many bounce back which will not be good for your website health. Lets make your website optimized by adding bunch of code in htaccess file.

What is .htaccess file ?

.htaccess is short name for Hypertext Access. This file act as an configuration file between your website and Apache web server, so you can alter the configuration using this file without any need of changing the server configuration. The htaccess file is named as exactly “.htaccess” and it control the directory it lives in and also control all sub directories underneath.

How .htaccess can help in website optimization

With htaccess file you can alter server configuration and we will add some bunch of code which will change server setting to get the website optimized. Settings we are going to change are Adding Compression, Setting up Header Expiry, Setting Header Cache controls inside htaccess file.

Get rid of ETags (Entity Tags) :

Add below one line code to your htaccess file and get rid of ETag from your server config. This will disable ETag header since we are going to use Expires.

Adding DEFLATE Compression :

Copy below code to your .htaccess file to activate the compression. It will simply reduce the size of document. Compression ins useful and mostly affect your website HTML FIles, CSS Files and JavaScripts. Compression can reduce the sizes by 50% to 80% which indirectly reduce the page size and server bandwidth. We can enable the compression using the module “mod_deflate” OR “mod_gzip” any one method can be used to enable the compression for your website. Below code will compress HTML, CSS, JavaScript, Text, XML and fonts.

Set Browser Caching :

Website must have the caching set properly to get pages load faster. Not having a cache will put load on your server and website will always do complex execution to load your website pages every time. A first-time visitor to your page will make several HTTP requests to download all your site’s files, but by using the Expires and Cache-Control headers you make those files cache-able. This avoids unnecessary HTTP requests on subsequent page views. We can use Apache modules – mod_expires and mod_headers for setting up caching and cache expiry. Paste below code to your htaccess file.

Add all above codes to your htaccess file and share your experience in comments. Any suggestion are welcome and will be updated to this article if it help increasing the website performance using htaccess techniques.

Previous PHP function to sort array alphabetically or numerically in ascending or descending order.
Next PHP Quiz for Advanced who are experts

About author

Rio
Rio 37 posts

Expert web developer working in PHP, Wordpress, Joomla, Magento, Javascript etc.

You might also like

WordPress 0 Comments

Remove & Clean not required items from WordPress Head Section.

If you check the source of your WordPress WebSite then you will see many attributes lines in your wordpress head section. Not all are required items and we always think

WordPress 0 Comments

Change admin username in wordpress for security

When you install new wordpress to create your website then the after setup the default admin username created is “admin” unless you specified any different username. This is the main

WordPress 0 Comments

Remove HTML Comments from wordpress website source

Once you are done creating your WordPress website, have a look at your HTML source code generated by the browser. You may notice many HTML comments added by your theme

WordPress 0 Comments

Secure WordPress login with additional Authentication Layer

We can use WordPress for creating a different website having default or custom functionalities. WordPress can be use for creating Blog, CMS, Ecommerce, Community, Social Site, Download Management, Movies Hub

WordPress 0 Comments

Remove Emoji Script & CSS from your wordpress source code.

When you install a new wordpress you will find a Emoji Script and CSS in your wordpress source code. Looking at the code you may feel it is unwanted and

WordPress 0 Comments

Remove category & tag base from WordPress url

WordPress permalinks add category as a base in URL of categories where your URL becomes /category/categoryname/ there is no issue in using this URL. But still many of us need