How to enable HTTP/2 on your hosting
HTTP/2 lets the browser load many files over one connection at the same time instead of queuing them, which makes pages with lots of CSS, JS and images noticeably faster, especially on mobile networks. Every current browser supports it and most hosting already has it, yet plenty of sites still answer over HTTP/1.1 because of how they are set up. The checker on this page connects the way a browser does and shows which protocol the server actually agreed to, so start there before you change anything.
Check your site
-
Check what the site speaks now
Run the checker on this page for your domain and look at the protocol line. HTTP/2 means you are done with this guide. HTTP/1.1 means the server, or something in front of it, did not offer HTTP/2 during the connection. The check negotiates HTTP/2 over TLS the way a browser does; HTTP/3 is announced separately through an Alt-Svc header and is not tested here.
-
Make sure the site runs on HTTPS
Browsers use HTTP/2 only over encrypted connections, where the protocol is agreed during the TLS handshake (ALPN). A site on plain http:// always stays on HTTP/1.1 in the browser, whatever the server supports. If the final address in the check starts with http://, set up a certificate and a redirect to HTTPS first.
-
On shared hosting, ask instead of configuring
HTTP/2 is switched on in the main server configuration, not in .htaccess, so no line you add to .htaccess can enable it. Hosting built on LiteSpeed or with nginx in front usually has it on for every site. If the check shows HTTP/1.1 on HTTPS, write to support and include the result: on a modern server it is one configuration change on their side, and a host that does not offer it at all runs outdated server software.
-
On your own Apache server
Load mod_http2 and add Protocols h2 http/1.1 to the main server configuration or to the HTTPS virtual host, then restart Apache. Use the event MPM: Apache's documentation warns that HTTP/2 works under prefork only with severe restrictions, and prefork is still the default on some setups with mod_php, so switching may also mean moving PHP to PHP-FPM.
-
On your own nginx server
Enable it in the server block that listens on 443: on nginx 1.25.1 and newer with the directive http2 on;, on older versions by adding http2 to the listen line, listen 443 ssl http2;. Test the configuration with nginx -t and reload. If several server blocks share the same IP and port, enable HTTP/2 the same way in all of them to avoid surprises.
-
Behind a CDN
With a CDN such as Cloudflare in front, visitors talk HTTP/2 or HTTP/3 to the CDN, which usually has it on by default, regardless of what your server supports. The check on this page then shows the CDN's protocol. The connection between the CDN and your server is a separate matter and has much less effect on page speed.
How to verify the result
Run the check on this page again after the change: the protocol line should now say HTTP/2. In Chrome you can also open DevTools, go to the Network tab, right-click the column headers, turn on Protocol and reload: your own files should show h2. If the check still shows HTTP/1.1, something in front of the server, a proxy or a load balancer, ends the TLS connection and needs HTTP/2 enabled as well.
Tip: HTTP/2 turns some old speed tricks into dead weight: there is no longer a reason to merge all CSS into one file, and spreading files across extra domains (domain sharding) works against it, because each extra domain needs its own connection. It will not fix a slow backend either: it speeds up the delivery of files, not the time the server needs to build the page (TTFB).