{"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":"2025-04-23T09:19:45","modified_gmt":"2025-04-23T09:19:45","slug":"improving-website-performance-enabling-keep-alive","status":"publish","type":"post","link":"\/uk\/tutorials\/improving-website-performance-enabling-keep-alive","title":{"rendered":"Keep-Alive: How Does It Improves Website Performance"},"content":{"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.<\/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\" target=\"_blank\" rel=\"noopener\"><img decoding=\"async\" width=\"1024\" height=\"283\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2022\/11\/eBook-Speed-Up-your-website-1024x283.png\" alt=\"\" class=\"wp-image-69260\" srcset=\"https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2022\/11\/eBook-Speed-Up-your-website-1536x425.png 1024w, https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2022\/11\/eBook-Speed-Up-your-website-300x83.png 300w, https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2022\/11\/eBook-Speed-Up-your-website-150x41.png 150w, https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2022\/11\/eBook-Speed-Up-your-website-768x212.png 768w, https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2022\/11\/eBook-Speed-Up-your-website.png 2048w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/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=\"\/uk\/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=\"\/uk\/tutorials\/wp-content\/uploads\/sites\/2\/2022\/03\/keep-alive.jpg\"><img decoding=\"async\" width=\"1000\" height=\"730\" src=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2022\/03\/keep-alive.jpg\" alt=\"A picture illustrating how Keep-Alive works when it is enabled and disabled.\" class=\"wp-image-49837\" srcset=\"https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2022\/03\/keep-alive.jpg 1000w, https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2022\/03\/keep-alive-300x219.jpg 300w, https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2022\/03\/keep-alive-150x110.jpg 150w, https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2022\/03\/keep-alive-768x561.jpg 768w\" sizes=\"(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=\"\/uk\/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\" target=\"_blank\" rel=\"noopener\">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=\"\/uk\/tutorials\/what-is-seo\/\">SEO<\/a>) performance.<\/li>\n\n\n\n<li><strong>Reduced <\/strong><a href=\"https:\/\/www.pcwdld.com\/network-congestion\" target=\"_blank\" rel=\"noopener\"><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=\"\/uk\/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\" target=\"_blank\" rel=\"noopener\">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=\"\/uk\/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=\"\/uk\/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=\"\/uk\/tutorials\/website-speed-test\/\">website speed test<\/a> using a tool such as <a href=\"https:\/\/gtmetrix.com\/\" target=\"_blank\" rel=\"noopener\"><strong>GTMetrix<\/strong><\/a>.<\/p><figure class=\"wp-block-image size-large\"><a href=\"\/uk\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/08\/GTmetrix-1.png\"><img decoding=\"async\" width=\"1024\" height=\"436\" src=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/08\/GTmetrix-1-1024x436.png\" alt=\"A screenshot showing GTMetrix website's front page\" class=\"wp-image-34823\" srcset=\"https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2021\/08\/GTmetrix-1.png 1024w, https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2021\/08\/GTmetrix-1-300x128.png 300w, https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2021\/08\/GTmetrix-1-150x64.png 150w, https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2021\/08\/GTmetrix-1-768x327.png 768w, https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2021\/08\/GTmetrix-1-1536x654.png 1536w\" sizes=\"(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\">\n<figure class=\"aligncenter size-full\"><a href=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2023\/03\/hpanel-hosting-performance-pagespeed-sidebar.png\"><img decoding=\"async\" width=\"468\" height=\"376\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2023\/03\/hpanel-hosting-performance-pagespeed-sidebar.png\" alt=\"The Page Speed button on hPanel\" class=\"wp-image-79628\" srcset=\"https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2023\/03\/hpanel-hosting-performance-pagespeed-sidebar.png 468w, https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2023\/03\/hpanel-hosting-performance-pagespeed-sidebar-300x241.png 300w, https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2023\/03\/hpanel-hosting-performance-pagespeed-sidebar-150x121.png 150w\" sizes=\"(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\">\n<figure class=\"aligncenter size-full\"><a href=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2016\/12\/hpanel-performance-pagespeed-result.png\"><img decoding=\"async\" width=\"1024\" height=\"270\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2016\/12\/hpanel-performance-pagespeed-result.png\" alt=\"hPanel page speed test result\" class=\"wp-image-84019\" srcset=\"https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2016\/12\/hpanel-performance-pagespeed-result.png 1024w, https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2016\/12\/hpanel-performance-pagespeed-result-300x79.png 300w, https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2016\/12\/hpanel-performance-pagespeed-result-150x40.png 150w, https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2016\/12\/hpanel-performance-pagespeed-result-768x203.png 768w\" sizes=\"(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\">\n<figure class=\"aligncenter size-large\"><a href=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/08\/filemanager-publichtml-htaccess-edit.png\"><img decoding=\"async\" width=\"1024\" height=\"484\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/08\/filemanager-publichtml-htaccess-edit-1024x484.png\" 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:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2021\/08\/filemanager-publichtml-htaccess-edit.png 1024w, https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2021\/08\/filemanager-publichtml-htaccess-edit-300x142.png 300w, https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2021\/08\/filemanager-publichtml-htaccess-edit-150x71.png 150w, https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2021\/08\/filemanager-publichtml-htaccess-edit-768x363.png 768w\" sizes=\"(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=\"\/uk\/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\" target=\"_blank\" rel=\"noopener\">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\" target=\"_blank\" rel=\"noopener\">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\" target=\"_blank\" rel=\"noopener\">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><?xml encoding=\"utf-8\" ?><figure class=\"wp-block-image size-full\"><a href=\"\/uk\/web-hosting\"><img decoding=\"async\" width=\"1024\" height=\"300\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2023\/11\/Web-hosting_in-text-banner.png\" alt=\"Hostinger web hosting banner\" class=\"wp-image-98604\" srcset=\"https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2023\/11\/Web-hosting_in-text-banner.png 1024w, https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2023\/11\/Web-hosting_in-text-banner-300x88.png 300w, https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2023\/11\/Web-hosting_in-text-banner-150x44.png 150w, https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2023\/11\/Web-hosting_in-text-banner-768x225.png 768w\" sizes=\"(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=\"\/uk\/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>\n\n\n<div class=\"protip\">\n                    <h4 class=\"title\">Learn more about boosting website speed<\/h4>\n                    <p><a href=\"\/uk\/tutorials\/website\/improving-website-performance-leveraging-browser-cache\">How to Leverage Browser Cache<\/a><br>\n<a href=\"\/uk\/tutorials\/website-cache\">What Is Website Caching and How to Clear It<\/a><br>\n<a href=\"\/uk\/tutorials\/website\/improving-website-performance-minifying-css-html-and-javascript\">How to Minify CSS, HTML and JavaScript<\/a><br>\n<a href=\"\/uk\/tutorials\/enable-gzip-compression\">How to Enable GZIP Compression<\/a><br>\n<a href=\"\/uk\/tutorials\/gtmetrix-for-testing-websites-speed\">How to Run a GTmetrix Speed Test<\/a><br>\n<\/p>\n                <\/div>\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=\"\/uk\/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":[22597,22598],"tags":[],"class_list":["post-715","post","type-post","status-publish","format-standard","hentry","category-website","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-UK","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\/uk\/tutorials\/wp-json\/wp\/v2\/posts\/715","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hostinger.com\/uk\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hostinger.com\/uk\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/uk\/tutorials\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/uk\/tutorials\/wp-json\/wp\/v2\/comments?post=715"}],"version-history":[{"count":27,"href":"https:\/\/www.hostinger.com\/uk\/tutorials\/wp-json\/wp\/v2\/posts\/715\/revisions"}],"predecessor-version":[{"id":112141,"href":"https:\/\/www.hostinger.com\/uk\/tutorials\/wp-json\/wp\/v2\/posts\/715\/revisions\/112141"}],"wp:attachment":[{"href":"https:\/\/www.hostinger.com\/uk\/tutorials\/wp-json\/wp\/v2\/media?parent=715"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hostinger.com\/uk\/tutorials\/wp-json\/wp\/v2\/categories?post=715"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hostinger.com\/uk\/tutorials\/wp-json\/wp\/v2\/tags?post=715"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}