In this tutorial, I will discuss about the importance of Permalink Structure in WordPress. And which is the Most SEO friendly Permalink Structure for your blog, How to edit it in WordPress.
Learn How to Enable Keep-Alive in WordPress. You need to add ‘Connection: Keep-Alive’ HTTP header in your server in order to enable Keep-Alive. You can also Enable Keep-Alive using .htaccess in WordPress. Or you can choose to edit config file of your Apache/NGINX servers if you do not have access to .htaccess file. The easiest way to Enable Keep-Alive using .htaccess is to add a piece of code (given below).
Before we start about the best practices to Enable Keep-Alive in WordPress and the dos and don’ts. First of all, we need to understand What Keep-Alive is? and How actually Keep-Alive works?
What is Keep-Alive and how it works?
Keep-Alive is a technique to let one TCP (Transmission Control Protocol) connection to access multiple files from server to web browser instead of creating new connection for every new request (file). Keep-Alive also known as persistent HTTP connection.
Furthermore, Lets’ discuss about how it works. You might know about the connection and coordination process of a web browser and server. When you visit a webpage, your web browser create a connection with web-server and sent a request to access a particular file, and server gives OK (go ahead) to the browser.
As a result, Browser started downloading the file, than create another connection for second file and the process goes on.
Suppose, if your web browser requires 10 (TEN) files to display a webpage, browser has to create 10 separate connections after each file download and request one by one to web server for OK to access files.
Therefore, Enabling Keep-Alive help browsers to create only SINGLE connection to access all the files from web server in one go (or in single OK). It significantly reduces number of requests to the web-server, and as a result that reduces Server CPU Uses (Server Load) as well. In addition to that, you will get considerable improvement in page loading speed.
How to enable Keep-Alive in WordPress
Whether you own a blog or a website, page-loading speed always matters and these simple techniques will boost your webpage loading speed by enabling Keep-Alive in WordPress.
Before applying any method, I would suggest you to check whether, is it already enabled on your website or disabled. Because, most of the modern hosting services had already activated Keep-Alive by default. However, you should check it by using this link.
Enable Keep-Alive plays an important role in order to increase your website loading speed. This is one of the most commonly adaptive method by pro-bloggers to reduce website loading time.
Finally, let’s discuss, how to Enable Keep-Alive using .htaccess in WordPress or on Apache/NGINX servers.
How to Enable Keep-Alive using .htaccess file in WordPress
You need to add the given below piece of code into your .htaccess file.
# TN START ENABLE KEEP ALIVE <ifModule mod_headers.c> Header set Connection keep-alive </ifModule> # TN END ENABLE KEEP ALIVE
Add this code after the last line in your .htaccess file; it will add Keep-Alive HTTP headers that enables Keep-Alive.
If you do not know how to edit .htaccess file or where to find it. Here is a complete guide about How to Edit .htaccess file in WordPress.
In very few cases .htaccess did not created automatically with WordPress installation. Either, you can create one by yourself, more details are here How to Create .htaccess file.
Enable Keep-Alive in Apache
In most of the new Apache servers, Keep-Alive should be auto enabled. If it is not enabled, find Apache HTTP Server configuration file (httpd.conf) of your server.
you can find it here – /etc/httpd/conf/httpd.conf
Add the below written code in that file…
# Set it On to enable Keep-Alive, Off to disable Keep-Alive KeepAlive On # Set maximum requests per connection, set 0 for unlimited request, 100 request per connection is ideal MaxKeepAliveRequests 100 # Set per connection timeout for next request KeepAliveTimeout 15
Enable Keep-Alive in NGINX
In almost all the NGINX servers, Keep-Alive comes enabled by default. However, if it is not enabled you can check the same by finding ‘keepalive_disable’ in NGINX core module (ngx_http_core_module).
Have you Enabled Keep-Alive on your website. YES, NO, Not Sure. Do check it again and Enable Keep-Alive using .htaccess in WordPress now.
Hope you find this guide useful. Which method you use to Enable Keep-Alive? Did you find any improvement in page loading speed? Do let us know in the comment section below.
In addition to that you may be interested to learn about WordPress PageSpeed Optimization:
Leverage Browser Caching in WordPress without Plugin
Is your blog optimized for SEO – Best settings for Yoast Plugin
Increase WP Speed – Enable Gzip Compression in WordPress via .htaccess file
Optimize Images in WordPress for PageSpeed
Optimize WordPress Robots.txt file for SEO and PageSpeed