The Onion-Location header is a standard HTTP response header that contains the .onion URL equivalent of the current page. When Tor Browser receives this header, it displays a ".onion available" badge in the address bar. Clicking this badge navigates the user to your hidden service, where all subsequent requests benefit from full Tor end-to-end encryption.
The header format is simple: Onion-Location: http://your56charaddress.onion/current/path. It should map the exact page the user is viewing on the clearnet to the equivalent page on your .onion site. This ensures a seamless transition - the user lands on the same content, just served through Tor's hidden service protocol.
Only Tor Browser responds to this header. Regular browsers ignore it entirely, so adding it has zero impact on non-Tor visitors. It is also the recommended approach over meta tag alternatives because it works before the page body is parsed, enabling faster redirects.