Check 05.02 · HTTP and redirects

Use 301/308 for permanent moves

Redirect each moved URL with a 301 or 308 to its equivalent on Apache, Nginx, Cloudflare, AWS, Plesk, cPanel, WordPress, Shopify, Laravel or Next.js, and check it.

Priority
Critical
Difficulty
Intermediate
Estimated time
30 min to 1 day
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

When a page changes address for good (new slug, new site structure, two pieces of content merged, domain change), the old URL must return a server-side permanent redirect, 301 Moved Permanently or 308 Permanent Redirect, to the new one. Once this check is done, each old URL leads in a single step to its exact equivalent, and the new URL returns 200.

Why it matters

A permanent redirect tells search engines: “this page now lives elsewhere, forget the old address”. Google treats it as a strong signal that the target should become the canonical URL, and shows the new address in its results. Bing also recommends the 301 for a permanent move.

Without a redirect, the old URL returns 404: it drops out of the index, the external links that pointed to it lead to a dead end, and visitors who had bookmarked it or find it in an AI assistant's answer land on an error. With a temporary redirect (302, 307), Google is more inclined to keep the old URL in its results.

301 and 308 have the same effect for Google. The difference is technical: with a 301, a browser may turn a POST request into a GET when following the redirect; the 308 requires the method to be kept. For web pages, both are fine; for an API or a form, prefer the 308.

What it improves

  • Indexing The new URL replaces the old one in the index, with no period of duplication.
  • Popularity External links to the old address keep benefiting the page. Google publishes no figure on the share that is passed on; the redirect remains the only way not to lose those links.
  • Visitors and AI citations Bookmarks, shares, campaigns and URLs cited by assistants keep leading to the right content.
  • Crawling Crawlers learn the new address and gradually stop requesting the old one.
  • Rankings No gain in itself; the redirect prevents a loss.

How to check

Test the old URL without following the redirect:

curl -s -o /dev/null -w "%{http_code} %{redirect_url}\n" https://www.example.com/ancienne-page/

Compliant result:

301 https://www.example.com/nouvelle-page/

Then check that the target returns 200 in one step:

curl -sIL https://www.example.com/ancienne-page/ | grep -i -E "^(HTTP|location)"

For a list of old URLs (an anciennes.txt file, one per line):

while read -r url; do
  curl -s -o /dev/null -L -w "%{num_redirects} %{http_code} %{url_effective} <- $url\n" "$url"
done < anciennes.txt

Compliant: 1 200 https://… on every line. A 0 indicates a URL that does not redirect, a number greater than 1 a chain.

In Search Console, the “Page with redirect” reason in the Page indexing report lists the old URLs that Google has correctly understood as redirected. Screaming Frog in list mode shows the code, the target and the type of each redirect.

How to implement

Before you start

  1. Build the mapping table: one row per old URL, with the new URL closest in content. No bulk redirect to the homepage: Google may treat it as a soft 404. See create a comprehensive redirect map (opens in a new tab).
  2. Target the final URL: scheme, host name and trailing slash included (https://www.example.com/nouvelle-page/), to avoid chains.
  3. Choose a single place: CDN, web server or application. Rules at several levels contradict each other and produce chains and loops.
  4. Test with a 302 first if the rule is complex: browsers remember 301s and 308s, so a mistake then stays in their cache. Switch to 301 once the result is validated.
  5. Keep redirects for a long time: Google advises at least a year and, if possible, indefinitely. See keep redirects for at least a year, ideally longer (opens in a new tab).

Example table:

Old URL New URL Code Reason
/blog/seo-2024/ /blog/guide-seo/ 301 Content updated and renamed
/produits/chaise-rouge /mobilier/chaises/chaise-rouge/ 301 New site structure
/tarifs-pro/ /tarifs/ 301 Two pages merged

Apache

Versions Apache 2.4.

In the virtual host or the .htaccess file at the root, before the CMS rules. For an exact URL, RedirectMatch with anchors avoids catching other pages:

RedirectMatch 301 ^/ancienne-page/?$ https://www.example.com/nouvelle-page/
RedirectMatch 308 ^/api/v1/commandes$ https://www.example.com/api/v2/commandes

For a whole folder, keeping the rest of the path:

RedirectMatch 301 ^/actualites/(.*)$ https://www.example.com/blog/$1

If the site already uses mod_rewrite (WordPress, PrestaShop, Laravel), write your redirects with RewriteRule to control the order of execution:

RewriteEngine On
RewriteRule ^ancienne-page/?$ https://www.example.com/nouvelle-page/ [R=301,L]
RewriteRule ^actualites/(.*)$ https://www.example.com/blog/$1 [R=301,L]

Redirect and RewriteRule keep the query string by default. For thousands of URLs, a RewriteMap saves thousands of lines, but it can only be declared in the server or virtual host configuration, not in a .htaccess file:

RewriteEngine On
RewriteMap redirections "txt:/etc/apache2/redirections.txt"
RewriteCond ${redirections:%{REQUEST_URI}} !=""
RewriteRule ^ ${redirections:%{REQUEST_URI}} [R=301,L]

The redirections.txt file contains one pair per line: /ancienne-page/ https://www.example.com/nouvelle-page/. Reload with sudo apachectl configtest && sudo systemctl reload apache2.

Nginx

Versions Nginx 1.18 and later.

In the server block, for an exact URL:

location = /ancienne-page/ {
    return 301 https://www.example.com/nouvelle-page/;
}

location ~ ^/actualites/(.*)$ {
    return 301 https://www.example.com/blog/$1$is_args$args;
}

For a long list, a map in the http context, for example in /etc/nginx/conf.d/redirections.conf:

map $uri $nouvelle_url {
    default "";
    /ancienne-page/ https://www.example.com/nouvelle-page/;
    /produits/chaise-rouge https://www.example.com/mobilier/chaises/chaise-rouge/;
}

Then in the server block:

if ($nouvelle_url) {
    return 301 $nouvelle_url$is_args$args;
}

Replace 301 with 308 if you want to keep the method. Reload with sudo nginx -t && sudo systemctl reload nginx.

LiteSpeed

Versions LiteSpeed Web Server 6.x, OpenLiteSpeed 1.7 and later.

LiteSpeed reads the RewriteRule rules in .htaccess: the mod_rewrite block from the Apache section works as is. LiteSpeed Web Server rereads the file on every change; OpenLiteSpeed reads it only if the “Auto Load from .htaccess” option is enabled, and requires a graceful restart after every rule change. Then purge the LSCache if the old pages were stored in it.

Caddy

Versions Caddy 2.

In the Caddyfile, in the site block:

example.com {
    redir /ancienne-page/ https://www.example.com/nouvelle-page/ permanent
    redir /api/v1/commandes /api/v2/commandes 308
}

permanent returns 301; with nothing specified, redir returns 302. Reload with sudo systemctl reload caddy.

IIS

Versions IIS 10, URL Rewrite module 2.1.

With the URL Rewrite module, in web.config:

<configuration>
  <system.webServer>
    <rewrite>
      <rules>
        <rule name="Ancienne page" stopProcessing="true">
          <match url="^ancienne-page/?$" />
          <action type="Redirect" url="https://www.example.com/nouvelle-page/" redirectType="Permanent" />
        </rule>
      </rules>
    </rewrite>
  </system.webServer>
</configuration>

Permanent returns 301. URL Rewrite cannot produce a 308; the IIS 10 HTTP Redirection module can, with httpResponseStatus="PermRedirect". For a long list, use a rewriteMap.

Cloudflare

Versions Cloudflare dashboard, all plans, November 2026.

Do the redirect at the edge, before the request even reaches the server:

  • A few pattern-based rules: from the Rules overview, Create rule > Redirect Rule. With a “Wildcard pattern”: request URL https://www.example.com/actualites/*, target URL https://www.example.com/blog/${1}, status code 301 or 308, and tick “Preserve query string”.
  • A list of individual URLs: Bulk Redirects, at account level, or from the zone in Rules > Settings, Bulk Redirects tab. Create a list, import a CSV with no header row (source URL, target URL, code), then a “Bulk Redirect Rule” that enables the list.
www.example.com/ancienne-page/,https://www.example.com/nouvelle-page/,301
www.example.com/produits/chaise-rouge,https://www.example.com/mobilier/chaises/chaise-rouge/,301

Cloudflare accepts 301, 302, 307 and 308. The host name must be proxied (orange cloud). The older Page Rules should be migrated to these rules.

AWS

Versions CloudFront, S3, Elastic Load Balancing and Amplify Hosting consoles, November 2026.

  • CloudFront: a CloudFront Function associated with the viewer request event responds with statusCode: 301 and a location header; for a long list, store the mappings in a CloudFront KeyValueStore.
  • S3 static website hosting: in the bucket properties, static website hosting accepts JSON redirection rules (KeyPrefixEquals to ReplaceKeyPrefixWith, with HttpRedirectCode set to 301).
  • Application Load Balancer: a listener rule with the “Redirect to URL” action and the HTTP_301 code. The ALB only offers 301 and 302.
  • Amplify Hosting: Hosting > Rewrites and redirects, type 301.

Plesk

Versions Plesk Obsidian 18.0.

Plesk has no per-URL redirect screen. If Apache is active, use the .htaccess file from the Apache section. Otherwise, paste the rules in Websites & Domains > your domain > Apache & nginx Settings, in the “Additional nginx directives” field:

location = /ancienne-page/ {
    return 301 https://www.example.com/nouvelle-page/;
}

cPanel

Versions cPanel & WHM 110 and later, Jupiter theme.

In Domains > Redirects, choose “Permanent (301)”, the domain, the path of the old page, then the full destination URL. Choose “Do Not Redirect www.” if your host redirect is already handled elsewhere. cPanel writes the rule into the .htaccess file. For more than a few dozen URLs, edit the file directly with the rules from the Apache section.

Shared hosting

At OVHcloud, o2switch, Infomaniak, Ionos or Hostinger, the .htaccess file from the Apache section works. Put the redirects at the top of the file, before the CMS rules. The “redirect” tools in customer areas usually redirect a whole domain, not a page.

Vercel

Versions vercel.json on Vercel, all plans, November 2026.

In vercel.json:

{
  "redirects": [
    { "source": "/ancienne-page", "destination": "/nouvelle-page", "permanent": true },
    { "source": "/actualites/:slug", "destination": "/blog/:slug", "statusCode": 301 }
  ]
}

permanent: true returns 308. For thousands of URLs with no pattern, Vercel offers bulk redirects: the bulkRedirectsPath property in vercel.json points to a CSV, JSON or JSONL file. In those files, permanent defaults to false (307): set permanent to true or statusCode to 301 on every line.

Netlify

Versions _redirects file on Netlify, all plans, November 2026.

In the _redirects file at the root of the publish directory:

/ancienne-page   /nouvelle-page   301
/actualites/*    /blog/:splat     301

The default code is 301. Netlify does not apply the rule if a file still exists at the old address: delete it or add ! (301!).

WordPress

Versions WordPress 6.4 to 7.1; Redirection 5.x, Rank Math and Yoast SEO Premium plugins.

  • Slug change: WordPress remembers the old slug of a published post and redirects with a 301 to the new one, with no plugin. This mechanism does not cover pages, categories or tags.
  • Other cases: the Redirection plugin (free) handles redirects one by one or by pattern, CSV import and the 404 log. Rank Math includes a redirections module; Yoast SEO keeps it for its Premium version.
  • Large volumes: prefer server rules (Apache or Nginx); Redirection can export its list in .htaccess and Nginx formats.

Shopify

Versions Shopify admin, all plans, November 2026.

In Content > Menus, click URL Redirects, then Create URL redirect or Import a CSV. When you change the URL handle of a product or a page, tick the box that creates a redirect from the old address. A Shopify redirect only applies if the old URL no longer matches any existing page.

PrestaShop

Versions PrestaShop 8 and 9.

For a discontinued product, the SEO tab of the product page offers a permanent redirect to another product or a category. For any other URL, use the .htaccess file and put your rules above the block generated by PrestaShop, which rewrites it every time friendly URLs are regenerated.

Wix

Versions Wix dashboard, Premium plans with a custom domain, November 2026.

In the dashboard, under SEO, open the URL Redirect Manager, then “New Redirect”. Wix automatically creates a 301 when you change a page's slug, except for blog posts. CSV import is available; redirects only work with a custom domain.

Squarespace

Versions Squarespace 7.0 and 7.1, all plans, November 2026.

Open Developer Tools in the site settings, “URL Mappings” section, and add one line per redirect:

/ancienne-page -> /nouvelle-page 301
/blog/[name] -> /articles/[name] 301

The rule only applies if the old page has been deleted or disabled.

Webflow

Versions Webflow, paid site plans, November 2026.

In Site settings > Publishing > 301 redirects, enter the old path and the new one, then publish. A whole folder is redirected with /ancien-dossier/(.*) to /nouveau-dossier/%1. This feature is only available on paid plans.

Laravel

Versions Laravel 10 to 13.

In routes/web.php:

Route::permanentRedirect('/ancienne-page', '/nouvelle-page');
Route::redirect('/tarifs-pro', '/tarifs', 308);

Route::redirect() without a code returns 302: always specify the code. In a controller, return redirect()->to($url, 301);. For thousands of URLs, a database table read by a middleware keeps the routes file light.

Next.js

Versions Next.js 14 to 16.

In next.config.js, before pages are rendered:

module.exports = {
  async redirects() {
    return [
      { source: '/ancienne-page', destination: '/nouvelle-page', permanent: true },
      { source: '/actualites/:slug', destination: '/blog/:slug', statusCode: 301 },
    ];
  },
};

permanent: true returns 308. These rules apply to the App Router as well as the Pages Router. In an App Router server component, permanentRedirect('/nouvelle-page') also returns 308, whereas redirect() returns 307: do not use it for a permanent move. With the Pages Router, getServerSideProps returns { redirect: { destination: '/nouvelle-page', permanent: true } }.

Common mistakes

  • Redirecting all old pages to the homepage: Google may treat these redirects as soft 404s. See avoid redirecting all removed pages to the homepage (opens in a new tab).
  • Leaving a default 302: Route::redirect(), Caddy's redir, the IIS HTTP Redirection module and several plugins create temporary redirects if you specify nothing.
  • Targeting a URL that itself redirects: every rule must point to the final URL. See fix redirect chains (opens in a new tab).
  • Using a JavaScript redirect or a meta refresh: Google can follow them, but not every crawler can. Keep them for cases where the server is out of reach.
  • Forgetting internal links: the site itself must point to the new URLs. See fix links to redirects or non-canonical URLs (opens in a new tab).
  • Removing redirects after a few months: external links, for their part, do not change.
  • Redirecting a page that has no equivalent: a 404 or a 410 is then the right response.

Frequently asked questions

What is the difference between a 301 and a 308 redirect for SEO?

None for Google: it treats the 301 and the 308 the same way, as a strong signal that the target should become the canonical URL. The difference is technical: with a 301, the browser may turn a POST request into a GET, whereas the 308 keeps the method. For web pages, either one is fine; for an API or a form, prefer the 308.

How long should I keep a 301 redirect?

Google recommends keeping redirects for as long as possible, generally at least a year. In practice, external links, bookmarks and URLs cited by AI assistants never disappear completely: keep redirects indefinitely if they cost nothing to maintain. Just update your own internal links and ask for the important external links to be corrected.

Does a 301 redirect lose SEO value?

A properly done 301 redirect, to equivalent content, lets Google transfer the indexing and signals of the old URL to the new one. Losses mostly come from a poorly chosen target, such as the homepage instead of the equivalent page, from redirect chains, or from redirects removed too early. A URL change sometimes leads to a period of fluctuation while Google processes the move.

Do I need a 301 redirect if I only change the slug of a WordPress post?

No, not for a published post: WordPress remembers the old slug and automatically redirects with a 301 to the new one. Check it with curl on the old address. Pages, categories and tags do not benefit from this mechanism: a plugin such as Redirection or Rank Math is still needed for them, as well as for any change to the permalink structure.

Updated on

Topic checklist (PDF)

And now?

In the “HTTP and redirects” topic

  1. Check that active pages return 200
  2. Use 301/308 for permanent moves
  3. Use 302/307 for temporary moves
  4. Fix redirect chains
  5. Fix redirect loops
  6. Fix broken internal links
  7. Fix broken external links
  8. Create a helpful 404 page
  9. Return 404/410 for removed content with no equivalent
  10. Avoid redirecting all removed pages to the homepage
  11. Fix unjustified 403s
  12. Fix excessive 429s
  13. Fix 5xx errors
  14. Monitor server errors
  15. Use 503 during temporary maintenance