{"id":715,"date":"2016-12-16T00:00:00","date_gmt":"2016-12-16T00:00:00","guid":{"rendered":"http:\/\/blog.hostinger.io\/hostinger-tutorials\/uncategorized\/improving-website-performance-enabling-keep-alive\/"},"modified":"2026-03-09T19:20:11","modified_gmt":"2026-03-09T19:20:11","slug":"improving-website-performance-enabling-keep-alive","status":"publish","type":"post","link":"\/ng\/tutorials\/improving-website-performance-enabling-keep-alive\/","title":{"rendered":"Keep-alive: how does it improves website performance"},"content":{"rendered":"<?xml encoding=\"utf-8\" ?><p>Enabling Keep-Alive can help to optimize website&rsquo;s performance and deliv&shy;er a bet&shy;ter user experience. It allows a visitor&rsquo;s browser to reuse a single TCP connection to load page content.<\/p><p>Keep-Alive is usually enabled by default on your origin server. But if this header is disabled, there are a few solutions to turn it on yourself.<\/p><p>This tutorial will show you the steps to enable Keep-Alive and files to prepare beforehand. It will also go over the reasons why you should activate Keep-Alive.<\/p><figure class=\"wp-block-image size-large\"><a href=\"https:\/\/assets.hostinger.com\/content\/tutorials\/pdf\/How-to-Speed-Up-Your-Website-EN.pdf\"><img loading=\"lazy\" decoding=\"async\" width=\"2048\" height=\"566\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2022\/11\/eBook-Speed-Up-your-website.png\/w=1024,h=1024,fit=scale-down\" alt=\"\" class=\"wp-image-69260\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2022\/11\/eBook-Speed-Up-your-website.png\/w=2048,fit=scale-down 2048w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2022\/11\/eBook-Speed-Up-your-website.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2022\/11\/eBook-Speed-Up-your-website.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2022\/11\/eBook-Speed-Up-your-website.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2022\/11\/eBook-Speed-Up-your-website.png\/w=768,fit=scale-down 768w\" sizes=\"auto, (max-width: 2048px) 100vw, 2048px\" \/><\/a><\/figure><h2 class=\"wp-block-heading\" id=\"h-what-is-keep-alive\">What Is Keep-Alive<\/h2><p>Keep-Alive, also known as a persistent connection, is a communication pattern between a server and a client to reduce the HTTP request amount and speed up a web page.<\/p><p>When Keep-Alive is turned on, the client and the server agree to keep the connection for subsequent requests or responses open.<\/p><h2 class=\"wp-block-heading\" id=\"h-how-does-keep-alive-work\">How Does Keep-Alive Work<\/h2><p>By default, HTTP connections close at the end of data transactions. This means that clients create a new connection to request each file of a page and servers close these TCP connections after sending the data.<\/p><p>However, if a server needs to respond to multiple HTTP requests simultaneously and serve a single file for each new TCP connection, the site page&rsquo;s load time will be increased. This can lead to a poor user experience.<\/p><p>To overcome this issue, website owners need to enable the Keep-Alive header to limit the number of new connections.<\/p><p>By turning the Keep-Alive connection header on, clients can download all the content such as <a href=\"\/ng\/tutorials\/what-is-javascript\/\">JavaScript<\/a>, CSS, images, and videos through a single TCP connection instead of sending a different request for each file.<\/p><p>Here&rsquo;s a picture to demonstrate how Keep-Alive works:<\/p><figure class=\"wp-block-image size-full\"><a href=\"\/ng\/tutorials\/wp-content\/uploads\/sites\/2\/2022\/03\/keep-alive.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"1000\" height=\"730\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2022\/03\/keep-alive.jpg\/public\" alt=\"A picture illustrating how Keep-Alive works when it is enabled and disabled.\" class=\"wp-image-49837\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2022\/03\/keep-alive.jpg\/w=1000,fit=scale-down 1000w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2022\/03\/keep-alive.jpg\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2022\/03\/keep-alive.jpg\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2022\/03\/keep-alive.jpg\/w=768,fit=scale-down 768w\" sizes=\"auto, (max-width: 1000px) 100vw, 1000px\" \/><\/a><\/figure><h2 class=\"wp-block-heading\" id=\"h-advantages-of-enabling-keep-alive\">Advantages of Enabling Keep-Alive<\/h2><p>Keep-Alive can <a href=\"\/ng\/tutorials\/speed-up-wordpress\/\">improve website speed<\/a> and performance as it maintains an open connection between a client and a server, saving the time needed to serve<strong> <\/strong>files.<\/p><p>Enabling Keep-Alive has additional benefits, such as:<\/p><ul class=\"wp-block-list\">\n<li><strong>Reduced CPU and memory usage <\/strong>&ndash; using persistent connections will benefit web hosting users. As fewer HTTP requests are generated, it reduces the usage of server resources.<\/li>\n\n\n\n<li><strong>HTTP pipelining<\/strong> &ndash; a client can deliver requests via the same TCP connection without waiting for the server to respond.<\/li>\n\n\n\n<li><strong>Modern browser support <\/strong>&ndash; many browsers use persistent connections automatically as long as the destination servers support<strong> <\/strong>Keep-Alive. A modern browser typically allows <a href=\"https:\/\/docs.pushtechnology.com\/cloud\/latest\/manual\/html\/designguide\/solution\/support\/connection_limitations.html\">six connections<\/a> per domain.<\/li>\n\n\n\n<li><strong>Increased SEO <\/strong>&ndash; enabling Keep-Alive improves site performance, which affects its search engine optimization (<a href=\"\/ng\/tutorials\/what-is-seo\/\">SEO<\/a>) performance.<\/li>\n\n\n\n<li><strong>Reduced <\/strong><a href=\"https:\/\/www.pcwdld.com\/network-congestion\"><strong>network congestion<\/strong><\/a><strong> <\/strong>&ndash; lowering the number of TCP connections between servers and clients frees up network bandwidth.<\/li>\n\n\n\n<li><strong>Improved SSL\/TLS performance<\/strong> &ndash; with Keep-Alive, an <a href=\"\/ng\/tutorials\/what-is-ssl\/\">SSL\/TLS<\/a> connection only opens once, avoiding the need for additional <a href=\"https:\/\/smallbusiness.chron.com\/meant-handshaking-protocol-73134.html\">handshakes<\/a> and improving site latency.<\/li>\n<\/ul><h2 class=\"wp-block-heading\" id=\"h-requirements-before-enabling-http-keep-alive\">Requirements Before Enabling HTTP Keep-Alive<\/h2><p>The file you need to prepare before enabling the HTTP Keep-Alive header depends on what server you use and your access privileges.<\/p><p>Make sure that you have access to one of the following files before continuing this guide:<\/p><ul class=\"wp-block-list\">\n<li><strong>.htaccess<\/strong> &ndash; a directory-level configuration file that can be used to change the functions and features of sites hosted on <a href=\"\/ng\/tutorials\/what-is-apache\/\">Apache<\/a>.<\/li>\n\n\n\n<li><strong>httpd.conf<\/strong> &ndash; the main configuration file of Apache. Note that you might not have access to this file if your website runs on shared hosting.<\/li>\n\n\n\n<li><strong>nginx.conf<\/strong> &ndash; the main configuration file of the <a href=\"\/ng\/tutorials\/what-is-nginx\/\">NGINX<\/a>.<\/li>\n<\/ul><p>When you&rsquo;re finished, follow these steps to enable Keep-Alive:<\/p><h2 class=\"wp-block-heading\" id=\"h-1-test-your-website-s-speed\">1. Test your Website&rsquo;s Speed<\/h2><p>Although many hosting providers have Keep-Alive enabled by default, some of them might have this header disabled for performance reasons.<\/p><p>To check whether Keep-Alive is enabled on your server, run a <a href=\"\/ng\/tutorials\/website-speed-test\/\">website speed test<\/a> using a tool such as <a href=\"https:\/\/gtmetrix.com\/\"><strong>GTMetrix<\/strong><\/a>.<\/p><figure class=\"wp-block-image size-large\"><a href=\"\/ng\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/08\/GTmetrix-1.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"436\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2021\/08\/GTmetrix-1.png\/w=1024,h=1024,fit=scale-down\" alt=\"A screenshot showing GTMetrix website's front page\" class=\"wp-image-34823\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2021\/08\/GTmetrix-1.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2021\/08\/GTmetrix-1.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2021\/08\/GTmetrix-1.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2021\/08\/GTmetrix-1.png\/w=768,fit=scale-down 768w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2021\/08\/GTmetrix-1.png\/w=1536,fit=scale-down 1536w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><p>Hostinger users can also use the <strong>page speed test<\/strong> feature on hPanel to check if Keep-Alive is working properly. You can access it by opening the hPanel dashboard and then going to the <strong>Performance &rarr; Page Speed<\/strong> section.<\/p><div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><a href=\"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-content\/uploads\/sites\/2\/2023\/03\/hpanel-hosting-performance-pagespeed-sidebar.png\"><img loading=\"lazy\" decoding=\"async\" width=\"468\" height=\"376\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/03\/hpanel-hosting-performance-pagespeed-sidebar.png\/public\" alt=\"The Page Speed button on hPanel\" class=\"wp-image-79628\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/03\/hpanel-hosting-performance-pagespeed-sidebar.png\/w=468,fit=scale-down 468w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/03\/hpanel-hosting-performance-pagespeed-sidebar.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/03\/hpanel-hosting-performance-pagespeed-sidebar.png\/w=150,fit=scale-down 150w\" sizes=\"auto, (max-width: 468px) 100vw, 468px\" \/><\/a><\/figure><\/div><p>Choose the website you want to test and the type of device. Click Analyze, then wait until the process is complete. If Keep-Alive is working properly, you should see a good score.<\/p><div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><a href=\"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-content\/uploads\/sites\/2\/2016\/12\/hpanel-performance-pagespeed-result.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"270\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2016\/12\/hpanel-performance-pagespeed-result.png\/public\" alt=\"hPanel page speed test result\" class=\"wp-image-84019\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2016\/12\/hpanel-performance-pagespeed-result.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2016\/12\/hpanel-performance-pagespeed-result.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2016\/12\/hpanel-performance-pagespeed-result.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2016\/12\/hpanel-performance-pagespeed-result.png\/w=768,fit=scale-down 768w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><\/div><p>If the analysis tool shows that Keep-Alive is disabled, move to the next step.<\/p><h2 class=\"wp-block-heading\" id=\"h-2-enable-keep-alive\">2. Enable Keep-Alive<\/h2><p>To enable Keep-Alive, you need to explicitly request it via the HTTP header by accessing <strong>.htaccess<\/strong> or the main configuration file of your web server. If you turn on Keep-Alive, the HTTP response header will show <code data-enlighter-language=\"generic\" class=\"EnlighterJSRAW\">Connection: keep-alive.<\/code><\/p><p>The following tutorial will cover four different methods to enable Keep-Alive on your server.<\/p><h3 class=\"wp-block-heading\" id=\"h-option-1-edit-the-htaccess-file\">Option 1 &ndash; Edit the .htaccess file<\/h3><p>Enable Keep-Alive and override any server settings by adding the following code to your <strong>.htaccess<\/strong> file:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;ifModule mod_headers.c&gt;\nHeader set Connection keep-alive\n&lt;\/ifModule&gt;<\/pre><p>This method should work on most Linux-based shared hosting providers. If you use Hostinger, locate the .htaccess file using the <strong>File Manager<\/strong>.<\/p><p>To do that, open the hPanel dashboard, then click the <strong>File Manager<\/strong> button. You can find the <strong>.htaccess<\/strong> file under the <strong>public_html<\/strong> folder. Right-click on the file, then choose <strong>edit<\/strong> to add the code.<\/p><div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><a href=\"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/08\/filemanager-publichtml-htaccess-edit.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"484\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2021\/08\/filemanager-publichtml-htaccess-edit.png\/w=1024,h=1024,fit=scale-down\" alt=\"The Edit option for the .htaccess file highlighted in the public_html folder on hPanel's File Manager\" class=\"wp-image-82390\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2021\/08\/filemanager-publichtml-htaccess-edit.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2021\/08\/filemanager-publichtml-htaccess-edit.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2021\/08\/filemanager-publichtml-htaccess-edit.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2021\/08\/filemanager-publichtml-htaccess-edit.png\/w=768,fit=scale-down 768w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><\/div><p>Make sure to test your website for any errors after editing the <strong>.htaccess<\/strong> file.<\/p><h3 class=\"wp-block-heading\" id=\"h-option-2-enable-keep-alive-in-apache-via-httpd-conf-file\">Option 2 &ndash; Enable Keep-Alive in Apache via httpd.conf file<\/h3><p>If you have access to the Apache configuration file, it&rsquo;s possible to enable the extension from there.<\/p><p>To locate the <strong>httpd.conf<\/strong> file, enter the following command into the command line:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">find \/ -name httpd.conf<\/pre><p>The following parameters affect Keep-Alive functionality in Apache, from enabling the persistent connection to defining the idle connection timeout:<\/p><ul class=\"wp-block-list\">\n<li><strong>KeepAlive <\/strong>&ndash; set to <code data-enlighter-language=\"generic\" class=\"EnlighterJSRAW\">KeepAlive On<\/code> to enable the extension or <code data-enlighter-language=\"generic\" class=\"EnlighterJSRAW\">KeepAlive Off<\/code><strong> <\/strong>to disable it.<\/li>\n\n\n\n<li><strong>MaxKeepAliveRequests<\/strong> &ndash; this directive sets the maximum number of user requests the server will maintain during each Keep-Alive connection. Consider setting its value to 50 requests for a single connection. Increase the limit if your server needs to deliver more responses.<\/li>\n\n\n\n<li><strong>KeepAliveTimeout<\/strong> &ndash; this value specifies how long the server waits for new requests from a client. It&rsquo;s recommended to keep the idle connection open for five or ten seconds and increase it if required. Setting this value too high may cause a high server load and waste memory resources.<\/li>\n<\/ul><p>Here is what the configuration should look like:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">#\n# KeepAlive: Whether or not to allow persistent connections (more than\n# one request per connection). Set to \"Off\" to deactivate.\n#\nKeepAlive On\n\n#\n# MaxKeepAliveRequests: The maximum number of requests to allow\n# during a persistent connection. Set to 0 to allow an unlimited amount.\n# We recommend you leave this number high, for maximum performance.\n#\nMaxKeepAliveRequests 50\n\n#\n# KeepAliveTimeout: Number of seconds to wait for the next request from the\n# same client on the same connection.\n#\nKeepAliveTimeout 10<\/pre><h3 class=\"wp-block-heading\" id=\"h-option-3-enable-keep-alive-header-in-nginx\">Option 3 &ndash; Enable Keep-Alive Header in NGINX<\/h3><p>As a web server and <a href=\"\/ng\/tutorials\/how-to-set-up-nginx-reverse-proxy\/\">reverse proxy, NGINX<\/a> has Keep-Alive enabled by default. In some cases, however, it may be disabled. Users can enable it using <a href=\"http:\/\/nginx.org\/en\/docs\/http\/ngx_http_core_module.html\">ngx_http_core_module<\/a>.<\/p><p>Look for the value <code data-enlighter-language=\"generic\" class=\"EnlighterJSRAW\">keepalive_disable<\/code> &ndash; in most cases, this will be the reason why Keep-Alive is not working.<\/p><p>Before deleting the value to enable Keep-Alive, make sure to find out why it was disabled in the first place.<\/p><h3 class=\"wp-block-heading\" id=\"h-option-4-enable-keep-alive-in-windows-server-iis\">Option 4 &ndash; Enable Keep-Alive in Windows Server (IIS)<\/h3><p>If you use a Windows-based server, enable the Keep-Alive extension through the command line.<\/p><p>The following command will enable it:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">appcmd set config \/section:httpProtocol \/allowKeepAlive:true<\/pre><p>If you wish to disable Keep-Alive, use:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">appcmd set config \/section:httpProtocol \/allowKeepAlive:false<\/pre><p>Windows Server users can also enable the Keep-Alive header by <a href=\"https:\/\/docs.microsoft.com\/en-us\/previous-versions\/windows\/it-pro\/windows-server-2008-R2-and-2008\/cc772183(v=ws.10)?redirectedfrom=MSDN\">editing the configuration files directly or writing WMI scripts<\/a>.<\/p><h2 class=\"wp-block-heading\" id=\"h-3-test-the-changes\">3. Test the changes<\/h2><p>Once Keep-Alive is enabled, run another scan with GTMetrix or KeyCDN&rsquo;s <a href=\"https:\/\/tools.keycdn.com\/curl\">HTTP Header Checker<\/a> to see whether the extension is active.<\/p><p>It&rsquo;s also possible to check the HTTP header via the terminal using the following command:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">curl -I http:\/\/example.com\/example.php<\/pre><p>In the following example, we&rsquo;ll check the HTTP header of <strong>hostinger.com<\/strong>:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">curl -i http:\/\/hostinger.com\/index.php<\/pre><p>This gives us the following results:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">HTTP\/1.1 301 Moved Permanently\nDate: Tue, 27 Jul 2021 01:55:24 GMT\nTransfer-Encoding: chunked\nConnection: keep-alive\nCache-Control: max-age=3600\nExpires: Tue, 27 Jul 2021 02:55:24 GMT\nLocation: \/index.php<\/pre><p>The <code data-enlighter-language=\"generic\" class=\"EnlighterJSRAW\">Connection: keep-alive<\/code> part shows that Keep-Alive is functional.<\/p><figure class=\"wp-block-image size-full\"><a class=\"hgr-tutorials-cta hgr-tutorials-cta-web-hosting\" href=\"\/ng\/web-hosting\" target=\"_blank\" rel=\"noreferrer noopener\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"300\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/11\/Web-hosting_in-text-banner.png\/public\" alt=\"Hostinger web hosting banner\" class=\"wp-image-98604\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/11\/Web-hosting_in-text-banner.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/11\/Web-hosting_in-text-banner.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/11\/Web-hosting_in-text-banner.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/11\/Web-hosting_in-text-banner.png\/w=768,fit=scale-down 768w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><h2 class=\"wp-block-heading\" id=\"h-conclusion\">Conclusion<\/h2><p>Enabling Keep-Alive is a great way to <a href=\"\/ng\/tutorials\/website-optimization\/\">optimize your website<\/a> as it helps improve speed and performance, ensuring faster load times and higher efficiency.<\/p><p>By turning the Keep-Alive header on, the client and server can reuse a single TCP connection for a number of requests and responses. This eliminates the need to establish new connections for each HTTP request or response.<\/p><p>Let&rsquo;s recap the steps to enable the Keep-Alive header:<\/p><ol class=\"wp-block-list\">\n<li><strong>Analyze your site <\/strong>&ndash; use a tool like GTMetrix to check whether Keep-Alive is functional.<\/li>\n\n\n\n<li><strong>Enable Keep-Alive<\/strong> &ndash; access <strong>.htaccess<\/strong> or your server&rsquo;s main configuration file to enable Keep-Alive via the HTTP header. Windows Server users can do this via the command line.<\/li>\n\n\n\n<li><strong>Test the changes<\/strong> &ndash; run another scan to see if Keep-Alive is active.<\/li>\n<\/ol><p>We hope this article has helped you enable Keep-Alive. If you have any questions, let us know in the comment section below.<\/p><p>        <div class=\"protip\">\n            <div class=\"protip__heading\">\n                <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\n                    <path d=\"M1.49234 23.5024C1.23229 23.5024 0.972242 23.4024 0.782206 23.2123C0.562165 22.9923 0.452144 22.6822 0.502153 22.3722C0.562165 21.9221 1.14227 17.9113 3.00262 16.351C3.63274 15.8209 4.43289 15.5509 5.26305 15.5609C6.09321 15.5909 6.87335 15.9109 7.47347 16.4911C8.6937 17.6913 8.76371 19.6717 7.6435 20.9919C6.0832 22.8523 2.08245 23.4324 1.63237 23.4924C1.59236 23.4924 1.54235 23.4924 1.50234 23.4924L1.49234 23.5024ZM5.16303 17.5613C4.84297 17.5613 4.53291 17.6713 4.29287 17.8813C3.60274 18.4614 3.07264 19.9317 2.75258 21.242C4.06282 20.9219 5.5331 20.3918 6.11321 19.7017C6.55329 19.1716 6.54329 18.3814 6.0832 17.9213C5.85316 17.7013 5.5431 17.5713 5.20304 17.5613C5.19304 17.5613 5.17303 17.5613 5.16303 17.5613ZM11.7243 21.8821C11.4942 21.8821 11.2642 21.8021 11.0841 21.652C10.8541 21.462 10.7241 21.1819 10.7241 20.8819V15.9109L8.08358 13.2705H3.11264C2.81259 13.2705 2.53254 13.1404 2.3425 12.9104C2.15246 12.6803 2.07245 12.3803 2.12246 12.0902C2.19247 11.7102 2.84259 8.36953 4.70294 7.12929C6.33325 6.04909 8.96375 6.49918 10.244 6.80923C11.5442 4.96889 13.2546 3.4286 15.2349 2.33839C17.4553 1.11816 19.9858 0.518051 22.4963 0.498047C23.0464 0.498047 23.4865 0.948132 23.4865 1.49824C23.4865 5.0389 22.3763 9.97983 17.1753 13.7605C17.4853 15.0408 17.9354 17.6613 16.8552 19.2816C15.615 21.1419 12.2744 21.7921 11.8943 21.8621C11.8343 21.8721 11.7743 21.8821 11.7143 21.8821H11.7243ZM12.7245 16.181V19.6016C13.7146 19.2916 14.7948 18.7915 15.2049 18.1814C15.675 17.4812 15.605 16.091 15.385 14.9008C14.5248 15.3808 13.6346 15.8109 12.7245 16.181ZM9.66388 12.0302L11.9643 14.3307C13.1845 13.8306 14.3648 13.2204 15.485 12.5103C19.9358 9.51974 21.2361 5.60901 21.4561 2.53843C19.6157 2.67846 17.8254 3.20856 16.2051 4.09872C14.2847 5.14892 12.6544 6.68921 11.4942 8.54956C10.7841 9.65977 10.174 10.82 9.66388 12.0302ZM4.39289 11.2701H7.81353C8.1936 10.3599 8.63368 9.46974 9.11377 8.60957C7.92355 8.38953 6.51329 8.31952 5.81315 8.78961C5.19304 9.19968 4.70294 10.3099 4.39289 11.2701Z\" fill=\"#673DE6\"\/>\n                <\/svg>\n                <p class=\"protip__title\">\n                    Learn more about boosting website speed                <\/p>\n            <\/div>\n            <p class=\"protip__content\"><a href=\"\/ng\/tutorials\/website\/improving-website-performance-leveraging-browser-cache\/\">How to Leverage Browser Cache<\/a><br>\n<a href=\"\/ng\/tutorials\/website-cache\/\">What Is Website Caching and How to Clear It<\/a><br>\n<a href=\"\/ng\/tutorials\/website\/improving-website-performance-minifying-css-html-and-javascript\/\">How to Minify CSS, HTML and JavaScript<\/a><br>\n<a href=\"\/ng\/tutorials\/enable-gzip-compression\/\">How to Enable GZIP Compression<\/a><br>\n<a href=\"\/ng\/tutorials\/gtmetrix-for-testing-websites-speed\/\">How to Run a GTmetrix Speed Test<\/a><br>\n<\/p>\n                    <\/div>\n        \n<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Enabling Keep-Alive can help to optimize website&rsquo;s performance and deliv&shy;er a bet&shy;ter user experience. It allows a visitor&rsquo;s browser to reuse a single TCP connection to load page content. Keep-Alive is usually enabled by default on your origin server. But if this header is disabled, there are a few solutions to turn it on yourself. [&#8230;]<\/p>\n<p><a class=\"btn btn-secondary understrap-read-more-link\" href=\"\/ng\/tutorials\/improving-website-performance-enabling-keep-alive\/\">Read More&#8230;<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"rank_math_title":"","rank_math_description":"Want to boost your site speed and improve user experience? Learn to enable keep-alive site via htaccess, Apache, NGINX or ISS.","rank_math_focus_keyword":"enabling keep-alive","footnotes":""},"categories":[22602],"tags":[],"class_list":["post-715","post","type-post","status-publish","format-standard","hentry","category-website-performance-optimization"],"hreflangs":[{"locale":"en-US","link":"https:\/\/www.hostinger.com\/tutorials\/improving-website-performance-enabling-keep-alive","default":0},{"locale":"pt-BR","link":"https:\/\/www.hostinger.com\/br\/tutoriais\/melhorando-o-desempenho-do-site-ativando-o-keep-alive","default":0},{"locale":"fr-FR","link":"https:\/\/www.hostinger.com\/fr\/tutoriels\/keep-alive","default":0},{"locale":"es-ES","link":"https:\/\/www.hostinger.com\/es\/tutoriales\/extension-keep-alive","default":0},{"locale":"id-ID","link":"https:\/\/www.hostinger.com\/id\/tutorial\/meningkatkan-performa-website-mengaktifkan-keep-alive","default":0},{"locale":"en-GB","link":"https:\/\/www.hostinger.com\/uk\/tutorials\/improving-website-performance-enabling-keep-alive","default":0},{"locale":"en-MY","link":"https:\/\/www.hostinger.com\/my\/tutorials\/improving-website-performance-enabling-keep-alive","default":0},{"locale":"en-PH","link":"https:\/\/www.hostinger.com\/ph\/tutorials\/improving-website-performance-enabling-keep-alive","default":0},{"locale":"es-MX","link":"https:\/\/www.hostinger.com\/mx\/tutoriales\/extension-keep-alive","default":0},{"locale":"es-CO","link":"https:\/\/www.hostinger.com\/co\/tutoriales\/extension-keep-alive","default":0},{"locale":"es-AR","link":"https:\/\/www.hostinger.com\/ar\/tutoriales\/extension-keep-alive","default":0},{"locale":"pt-PT","link":"https:\/\/www.hostinger.com\/pt\/tutoriais\/melhorando-o-desempenho-do-site-ativando-o-keep-alive","default":0},{"locale":"en-IN","link":"https:\/\/www.hostinger.com\/in\/tutorials\/improving-website-performance-enabling-keep-alive","default":0},{"locale":"en-CA","link":"https:\/\/www.hostinger.com\/ca\/tutorials\/improving-website-performance-enabling-keep-alive","default":0},{"locale":"en-AU","link":"https:\/\/www.hostinger.com\/au\/tutorials\/improving-website-performance-enabling-keep-alive","default":0},{"locale":"en-NG","link":"https:\/\/www.hostinger.com\/ng\/tutorials\/improving-website-performance-enabling-keep-alive","default":0}],"_links":{"self":[{"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/posts\/715","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/comments?post=715"}],"version-history":[{"count":28,"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/posts\/715\/revisions"}],"predecessor-version":[{"id":145414,"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/posts\/715\/revisions\/145414"}],"wp:attachment":[{"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/media?parent=715"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/categories?post=715"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/tags?post=715"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}