How to enable keep-alive connections
Keep-alive connections use a single TCP connection to handle multiple HTTP requests and responses. Instead of opening a new TCP connection every time a browser sends a request, keep-alive connections enable clients and servers to communicate more efficiently and use fewer resources. Many performance testing sites, such as GTMetrix, check if keep-alive connections are enabled for a site. If they are disabled, you receive a lower site performance score. If keep-alive connections are disabled for your site, you can easily enable them. To do this, follow these steps:- Edit or create an .htaccess file in your site’s document root directory.
- Copy the following lines and paste them into the .htaccess file:
- Save your changes to the .htaccess file. Keep-alive connections are now enabled.