Check 23.14 · Hreflang and regional variants

Update annotations when a translation is removed

When a translation is removed, take it out of the other versions' hreflang annotations, the sitemap and the cache, and handle its old URL.

Priority
Critical
Difficulty
Intermediate
Estimated time
30 min per case, 1 day to automate
Free, no account: your progress is saved in this browser.

Ask an AI to check this point on your site

Opens the assistant with a ready-made question: this check, its goal and your site URL.

For Gemini, Copilot or another assistant, copy the question. The link opens the chosen service directly: nothing goes through this site.

In short

A translation disappears: page deleted, unpublished, set to noindex, language dropped or product withdrawn from a market. Its hreflang annotations must then disappear from every other version of the page, from the sitemap and from the caches, and its old URL must return a clear response (301 redirect or 404/410). Once the task is done, no annotation on the site points to a URL that does not return 200.

Why it matters

hreflang annotations describe a group of equivalent pages. When a page leaves the group, all the others keep announcing it until someone changes them. Google asks that each pair of pages reference each other and ignores annotations without a return link: a deleted page no longer returns anything, so the annotation pointing to it becomes useless.

The problem is rarely visible. The remaining versions display normally, and Search Console has offered no hreflang report since the “International Targeting” report was retired in 2022. The symptoms show up later: crawlers following links to 404s or redirects, a sitemap announcing dead URLs, and sometimes an entire group misinterpreted because the x-default page was precisely the one that disappeared.

Removing a translation is also a moment when other things often break: the language switcher points to a 404, a redirect sends German visitors to a French page without warning, or the dropped language leaves orphaned internal links.

What it improves

  • Valid hreflang groups All remaining annotations point to pages that return 200, are indexable and are reciprocal.
  • Crawling Fewer crawler requests to redirects and 404s.
  • Visitor experience The language switcher no longer leads to an error page.
  • Reliable sitemap It lists only published URLs, which preserves its value as a signal.
  • Rankings No direct effect; above all, you prevent a group from being ignored or served incorrectly.

How to check

Check the HTTP status code of every target announced by a page:

curl -s https://example.com/fr/tarifs/ \
  | grep -o '<link[^>]*hreflang[^>]*>' \
  | grep -o 'href="[^"]*"' | cut -d'"' -f2 \
  | while read -r url; do
      printf '%s %s\n' "$(curl -s -o /dev/null -w '%{http_code}' "$url")" "$url"
    done

Expected result: only 200 lines. A 301, 404 or 410 indicates an annotation to remove.

Across the whole site:

  • Screaming Frog: crawl with hreflang crawling enabled, then the Hreflang tab, filters on non-200 hreflang URLs and missing return links.
  • Sitemap: search the xhtml:link entries for URLs of the removed language or page.
  • Search Console: the Pages report, filtered on the prefix of the language concerned; a sudden rise in “Not found (404)” or “Page with redirect” reveals annotations or links that were not updated.

Good to know: always test after purging the cache, or by bypassing the CDN. A page served from the cache shows the old list even when the CMS has already been fixed.

How to implement

Before you start

Each removal calls for two decisions: what happens to the old URL, and what happens to the other versions.

The old URL of the removed translation:

Situation Response Why
The content still exists in the same language under another URL 301 to that URL Preserves links and signals
The content no longer exists in this language but a close page does (category, parent page) 301 to the close page in the same language Avoids a dead end for the visitor
The entire language is dropped 301 to the fallback version (often English or the language selection page), with a clear message Visitors arrive from links and bookmarks
The content is deleted with no equivalent 410 or 404 A redirect to an unrelated page would be treated as a soft 404
Translation temporarily withdrawn for review Keep the URL offline as a 404 or leave the old version published A long “temporary” redirect blurs the signals

Do not automatically redirect to the same page in another language without the visitor knowing. See plan for missing translations (opens in a new tab).

The other versions:

  1. Remove the annotation pointing to the removed URL from every remaining version.
  2. If the removed URL carried the x-default, reassign the x-default to another version.
  3. If only one version remains, remove all annotations: a one-page group makes no sense.
  4. Remove the URL and its xhtml:link entries from the sitemap.
  5. Fix the language switcher and internal links that pointed to it.
  6. Purge the cache of every remaining version, not just the deleted page.

With properly built automatic generation (see automate annotations through the CMS (opens in a new tab)), points 1 to 5 happen on their own. Point 6 often remains manual: it is the most frequent cause of outdated annotations.

Step 1 — List what is being removed

Before any deletion, record in a table the removed URL, the decision taken and the URLs of the group:

Removed URL Group (other versions) Old URL response New x-default Cache purged Checked on
/it/prezzi/ /fr/tarifs/, /de/preise/, /en/pricing/ 301 to /it/ unchanged (/en/pricing/) yes 2026-11-25
/en/pricing/ /fr/tarifs/, /de/preise/ 301 to /en/plans/ /fr/tarifs/ yes 2026-11-25

Step 2 — Remove the translation in the CMS

Unpublish or delete the translation through the CMS, not by deleting a file or a database row: the CMS is what recalculates the groups.

Step 3 — Respond on the old URL

Set up the redirect or the 410 according to the table above (examples by environment below).

Step 4 — Purge and check

Purge the cache of every version in the group, rerun the command from the “How to check” section on each one, and check the sitemap.

Apache

Versions Apache 2.4.

In the .htaccess file at the root or in the virtual host:

RewriteEngine On

# Translation moved: 301 to the equivalent in the same language
RewriteRule ^en/pricing/?$ /en/plans/ [R=301,L]

# Italian language dropped: 301 to the fallback home page
RewriteRule ^it/ /en/ [R=301,L]

# Translation deleted with no equivalent: 410
RewriteRule ^de/aktion-2025/?$ - [G,L]

Reload with sudo apachectl configtest && sudo systemctl reload apache2 if you change the virtual host.

Nginx

Versions Nginx 1.18 and later.

In the server block:

location = /en/pricing/ {
    return 301 /en/plans/;
}

location ^~ /it/ {
    return 301 /en/;
}

location = /de/aktion-2025/ {
    return 410;
}

Reload with sudo nginx -t && sudo systemctl reload nginx. Then purge the Nginx page cache, if there is one (fastcgi_cache or proxy_cache), for the other versions in the group.

Cloudflare

Versions Cloudflare dashboard and API v4, all plans, November 2026.

For an entire language or a list of URLs, use Bulk Redirects or Redirect Rules, from the Rules overview. Then purge the remaining versions by URL in Caching > Configuration, or through the API:

curl -X POST "https://api.cloudflare.com/client/v4/zones/ZONE_ID/purge_cache" \
  -H "Authorization: Bearer API_TOKEN" \
  -H "Content-Type: application/json" \
  --data '{"files":["https://example.com/fr/tarifs/","https://example.com/de/preise/","https://example.com/sitemap.xml"]}'

Without this purge, Cloudflare keeps serving cached HTML pages with the old list of annotations.

AWS

Versions CloudFront, console and AWS CLI v2, November 2026.

On CloudFront, invalidate every version in the group and the sitemap after the change:

aws cloudfront create-invalidation --distribution-id DISTRIBUTION_ID \
  --paths "/fr/tarifs/" "/de/preise/" "/sitemap.xml"

Redirects are set up on the origin or with a CloudFront Function on the viewer-request event.

WordPress

Versions WordPress 6.4 to 7.1, with WPML 4.5 and later or Polylang 3.0 and later.

  • WPML and Polylang: deleting or unpublishing a translation removes it from the other versions' annotations and from the SEO plugin's sitemap. A translation moved to the trash is no longer published; still check that it has disappeared from the annotations.
  • Redirect: set up the 301 with the Redirection plugin or with your SEO plugin's redirect feature (Rank Math and Yoast SEO Premium offer one).
  • Cache: purge the entire page cache, not just the deleted URL. Plugins usually purge the modified page and the home page, rarely the other language versions.
  • Dropped language: in WPML or Polylang, deleting a language removes its content; set up the redirects for all its URLs first.

Shopify

Versions Shopify admin, all plans, November 2026.

Removing a language from a market, unpublishing a language or removing a product from a market updates the tags Shopify generates. Create the URL redirects in the admin: Content > Menus > View URL redirects > Create URL redirect. If hreflang tags were added by hand in the theme, they do not follow: one more reason to delete them.

Drupal

Versions Drupal 10 and 11, with the contributed Redirect module (8.x-1.x branch).

With Content Translation, an unpublished translation no longer appears in the other versions' alternate tags. Delete the translation from the content's Translate tab, set up the redirect with the Redirect module, then clear the caches (drush cr) or, better, let cache tags invalidate the related pages.

Laravel

Versions Laravel 11 to 13, and Laravel 10 from 10.44, which introduced the #[ObservedBy] attribute.

Hook the update into the model lifecycle, so that every version in the group is purged and the sitemap is regenerated:

// app/Observers/PageObserver.php
namespace App\Observers;

use App\Jobs\PurgePageCache;
use App\Jobs\RegenerateSitemaps;
use App\Models\Page;

class PageObserver
{
    public function updated(Page $page): void
    {
        if (! $page->wasChanged(['is_published', 'is_indexable', 'slug'])) {
            return;
        }

        $this->refreshTranslationGroup($page);
    }

    public function deleted(Page $page): void
    {
        $this->refreshTranslationGroup($page);
    }

    private function refreshTranslationGroup(Page $page): void
    {
        Page::query()
            ->where('translation_group', $page->translation_group)
            ->each(fn (Page $translation) => PurgePageCache::dispatch($translation));

        RegenerateSitemaps::dispatch();
    }
}

Register the observer with the #[ObservedBy(PageObserver::class)] attribute on the model. The PurgePageCache and RegenerateSitemaps jobs are yours to write, depending on your cache (Cloudflare, Varnish, response cache) and your sitemap generator.

Next.js

Versions Next.js 15 and 16 (App Router).

If the pages are static or regenerated (ISR), the deleted page disappears, but the other versions keep their old metadata until they are revalidated. In the CMS publishing webhook, revalidate the whole group:

// app/api/revalidate/route.ts
import { revalidatePath } from 'next/cache'
import { getTranslationGroupPaths } from '@/lib/cms'

export async function POST(request: Request) {
  const { groupId } = await request.json()
  const paths = await getTranslationGroupPaths(groupId)

  paths.forEach((path) => revalidatePath(path))
  revalidatePath('/sitemap.xml')

  return Response.json({ revalidated: paths.length })
}

Protect this route with a secret shared with the CMS. Permanent redirects are declared in next.config.js or next.config.ts (redirects() with permanent: true), or in the proxy (proxy.ts, named middleware.ts before Next.js 16).

Common mistakes

  • Deleting the page without purging the other versions: the CMS is up to date, but the cache keeps serving the old list for days.
  • Forgetting the x-default: the removed version carried the x-default, and the whole group still announces it.
  • Redirecting to the language's home page: for a page with no equivalent, Google may treat the redirect as a soft 404; a 410 is more honest.
  • Redirecting to another language without saying so: the Italian visitor ends up on an English page without understanding why.
  • Leaving the annotation pointing to the redirect: a 301 target is not a valid target, even if the destination is correct. See exclude redirects and nonexistent pages (opens in a new tab).
  • Setting the translation to noindex while keeping the annotations: a non-indexable target has no place in the group.
  • Hand-written annotations: nobody thinks of changing the other versions.

Frequently asked questions

What should you do with the URL of a deleted translation?

Redirect it with a 301 to the closest equivalent in the same language if the content still exists elsewhere, or to a relevant parent page. If the content is deleted with no equivalent, return a 410 or a 404: a redirect to an unrelated page may be treated as a soft 404. In every case, remove this URL from the other versions' hreflang annotations and from the sitemap.

Should you remove the hreflang annotation if the translated page redirects?

Yes. An hreflang annotation must point to the final URL, which returns 200 and whose canonical points to itself. A redirecting target is not valid, even if the destination is the right one: replace it with the destination URL if that is the exact equivalent in the same language, or remove the annotation if the destination is only a close page. Make the change on every version in the group.

Does Search Console report hreflang errors?

No, not since 2022. Google retired the “International Targeting” report, which listed hreflang errors, while continuing to use the annotations. To spot an annotation pointing to a removed translation, crawl the site with a tool that reads hreflang, such as Screaming Frog, or check each target's HTTP status code with a script. A rise in 404s or redirects for one language in the Pages report is an indirect clue.

What happens if only one version of a page remains?

Remove all its hreflang annotations. An hreflang group exists to choose between several versions; a single page that only points to itself gives the search engine no information. Keep its self-referencing canonical and its lang attribute. If a translation comes back later, automatic generation will recreate the group on every version at the same time.

Updated on

Topic checklist (PDF)

And now?

In the “Hreflang and regional variants” topic

  1. Implement hreflang for equivalent pages
  2. Check reciprocity
  3. Include the self-referencing annotation
  4. Use absolute URLs
  5. Validate ISO 639-1 language codes
  6. Validate ISO 3166-1 Alpha-2 country codes
  7. Use en-GB rather than en-UK
  8. Use x-default if relevant
  9. Check that targets return HTTP 200
  10. Check that targets are indexable
  11. Exclude redirects and nonexistent pages
  12. Align hreflang and canonical
  13. Automate annotations through the CMS
  14. Update annotations when a translation is removed
  15. Use HTTP headers for PDFs if needed
  16. Check consistency across HTML, HTTP header and sitemap methods if combined
  17. Test same-language variants for different countries