On this page
Before launching a seasonal campaign, check that your pages advertise the alternate language versions or formats you intend visitors and automated clients to find. An old campaign page can remain in an HTTP Link header even after the destination has moved or been retired.
This guide shows how to inspect an HTTP Link header with rel="alternate", resolve its targets, and check whether those targets are reachable and suitable for the campaign.
Key Takeaways
- An HTTP
Linkheader can advertise a related resource, including an alternate representation of a page. - Inspect the response from each relevant URL, including any redirect responses, and resolve relative targets against the URL that supplied the header.
- A successful response is not enough: check the destination’s language, format, content, and accessibility for its intended audience.
- Search-engine treatment can have additional requirements. RFC 8288 and platform-specific documentation were not available to consult for this article, so verify those requirements before relying on a header for discovery or indexing.
What does rel="alternate" advertise?
An HTTP Link response header describes a relationship between the responding resource and another resource. For example, a server might be configured to send Link: </fr/campaign>; rel="alternate"; hreflang="fr" with its campaign page. The target is /fr/campaign, the relation is alternate, and hreflang indicates the target’s intended language.
The header is different from both of these:
- An HTML anchor, such as
<a href="/fr/campaign">Français</a>, creates a link in the document that visitors can use. An HTTP header is response metadata; it does not by itself create a visible navigation link. - Canonical metadata identifies a preferred URL for a resource. An alternate relation describes another representation or version. They serve different purposes; a canonical link can also be expressed in an HTTP
Linkheader or in HTML.
An alternate label does not ensure that the target is translated, current, public, or accepted by a particular search engine. Those properties need separate checks.
Advertisement
Inspect the campaign response
Use a terminal with curl on a Unix-like system. The commands below use the reserved example domain as a stand-in; replace the URL with a page you own or are authorized to check. The commands have not been executed for this article.
First, request the page without automatically following redirects:
curl -sS -D - -o /dev/null -- https://www.example.org/campaign
-D - prints response headers, while -o /dev/null discards the response body. This is a GET request, so it avoids assuming that a server’s HEAD response has the same headers as its GET response. Look for the status line, any Location header, and every Link header.
A server may send multiple Link fields, or put multiple link values in one field. For example, a configuration could contain these two values in one field: Link: </fr/campaign>; rel="alternate"; hreflang="fr", </campaign.pdf>; rel="alternate"; type="application/pdf". The first advertises a language version; the second advertises a format. The type parameter is a format hint, not proof of the returned content.
Do not parse a complex Link field by blindly splitting on commas: commas can also occur inside a target or a quoted parameter. For automation, use a parser that understands HTTP Link field syntax.
Check redirects and relative targets
Next, inspect the full redirect chain:
curl -sS -L --max-redirs 5 -D - -o /dev/null -- https://www.example.org/campaign
The printed headers can contain several response blocks. Identify which URL produced each block, then inspect the final response as well as any redirects. A header on a redirect response is not automatically the same as a header on the final page.
Resolve a relative target against the URL of the response that contains it. For example, if https://www.example.org/campaign sends </fr/campaign>, its target is https://www.example.org/fr/campaign. If the final response after a redirect sends summer-fr.html, resolve that reference against the final response URL instead.
Only follow targets and redirects you are authorized to inspect. In automated checking systems, restrict outbound destinations and revalidate redirects; fetching arbitrary advertised URLs can expose internal network resources.
Advertisement
Verify each advertised alternate
For each target, resolve its URL and inspect its response and redirect chain with the same commands. For example:
curl -sS -L --max-redirs 5 -D - -o /dev/null -- https://www.example.org/fr/campaign
Then open the final URL in a browser or retrieve its body separately. Check the following:
- Status and redirects: Does the target reach the intended page, rather than an error, unrelated landing page, or expired promotion? A redirect can be legitimate, but review its destination.
- Language or format: Does the content match the advertised language or media type? A
Content-TypeorContent-Languageheader can help, but also inspect the actual content. - Campaign relevance: Are dates, offers, links, and branding current for the seasonal campaign? A reachable page can still be stale.
- Access: Can the intended audience reach it without an unexpected login, geographic restriction, or error? Test from the relevant environment when possible.
- Consistency: Compare the header with any alternate links in the HTML and with your site’s actual navigation. Investigate mismatches rather than assuming every consumer will resolve them identically.
Repeat the check after deployment and after any campaign URL, redirect, translation, or document changes. If your site varies responses by region, language, authentication, or cache, inspect representative variants as well.
Common Mistakes
- Checking only the final page: An intermediate redirect may carry a different
Linkheader, while the final response may omit the intended one. - Treating a 200 status as a content check: A successful response might be an obsolete campaign, a generic fallback, or a login page.
- Resolving all relative links against the original URL: Use the URL of the response that actually supplied each header.
- Assuming HTTP and HTML links are interchangeable: A visitor-facing anchor and a response header have different roles; use each where appropriate.
- Assuming search engines interpret every alternate the same way: Check the relevant platform’s current documentation for its supported syntax and requirements.
Best Practices
Keep an inventory of campaign pages and their intended alternate URLs, languages, and formats. Review the server or CDN configuration that generates the headers, remove retired targets, and include alternate checks in your campaign release process. For automated checks, set timeouts and response-size limits as well as outbound-network restrictions.
Conclusion
Inspect the actual response headers, follow each advertised alternate, and verify the destination’s content and access. This catches stale or misleading campaign metadata before it reaches visitors and automated clients.
What would your domain sell for?
A free TidyURLs account unlocks the Domain Estimator. It prices a name from 191,011 real domain sales.