Technical SEO 7 min read

Website redirects: what they are and how to do them right

A website redirect is a server response that sends a visitor who opened an old URL to the new address using a redirect code: 301, 302, 307 or 503. You need them when you change a page address, switch domain, move to HTTPS or merge content.

Roland Kivitare, SEO expert at Rolevents Roland Kivitare SEO expert · Rolevents

When do you need a website redirect?

You need one when you change page addresses or move to a new domain. A website redirect takes the visitor, and Google, from the old address to the right new page. A missing redirect can cause a 404 error and reduce your visibility on Google. This guide shows how to collect your old URLs, set up 301 rules and check the result.

  • DNS (Domain Name Server) points the domain to the right server, but it does not redirect individual URLs. 301 suits a permanent move, 302 or 307 a temporary change.
  • Use a canonical tag when both URLs stay accessible but Google should prefer one version. For temporary maintenance or a server failure, return 503.

1. Prepare the redirect

Before creating redirect rules, pin down the scope of the change and the final destination (final URL). Check five things:

  1. Goal: are you changing domain, changing structure or merging pages?
  2. Scope: does the change affect the whole domain, a folder or selected URLs?
  3. Target URL: does the new page open over HTTPS and return a 200 code?
  4. Access: can you get into the domain, server, CDN and CMS settings?
  5. Owner: who publishes the rules and checks the result?
  6. Only start setting things up once you have these answers.

2. Take an inventory of your old URLs

Gather all old URLs into one list. The menu alone will not show old articles, campaign pages, products or addresses with external links.

Collect URLs from four places:

  1. Crawl the whole site with the Screaming Frog app.
  2. Export the pages from Google Search Console.
  3. Check the XML sitemap and GA4 landing pages.
  4. Add the e-shop export and URLs with external links.
  5. Merge the files and remove duplicates. The free version of Screaming Frog crawls up to 500 URLs, which is enough for a first check of a small site.

3. Build a URL mapping table

Give every old URL one decision: a 301 redirect, a merge or a 410 response. Add the old address, the new target, the HTTP status and the reason for the decision to the table.

Old URL New URL Status Note
/gb/products/wool-coat /en/products/wool-coat 301 Same product, the change comes from switching the language version gb -> en
/gb/products/old-wool-coat /en/products/wool-coat 301 The old variant is merged
/gb/campaign/summer-sale None 410 No replacement, the change is intentional and saves crawl budget.

Check that each old URL appears in the table only once and that the new target opens with a 200 code. The redirect must lead straight to the final page, not through another redirect.

4. Choose the redirect type

For a permanent URL or domain move, use a 301 redirect. It ties the old address to the new one, although keeping your Google rankings is not guaranteed.

Option Use
301 Permanent URL or domain change
302/307 Temporary change
Canonical The same content on several accessible URLs
503 Temporary maintenance or server failure

The meanings of the response codes are described in the RFC 9110 standard.

5. Set up the redirect rules

Turn the mapping table into 301 rules in Cloudflare, on the hosting server or in the application. Choose one place to manage the rule for each old URL.

Zone or Cloudflare

  • Use the same prepared URL map for the whole migration, not separate lists in the host and in the code.
  • Zone's Redirects or .htaccess: manage the rules in one place, either in Zone's redirects view or in the .htaccess file.
  • Cloudflare Redirect Rules: condition (http.request.uri.path eq "/old-service") + Static Redirect to https://domain.ee/new-service, Status code 301
  • Domain migration rule: Expression (http.host eq "old-domain.ee") → Target concat("https://new-domain.ee", http.request.uri.path), Status 301, Preserve query string: Enabled

Zone's control panel view depends on your plan. I wrote separately about how to choose web hosting that also supports SEO in my web hosting and SEO article. In the redirects view, enter the old path, the new HTTPS address and the code 301, or use a server rule.

In Cloudflare, create a Redirect Rules rule:

  • Condition: http.request.uri.path eq "/old-service"
  • Target: https://domain.ee/new-service
  • Status: 301
  • When moving a whole domain, use the old host as the condition and keep the path and query parameters.

cPanel or Apache

In cPanel, open Domains > Redirects, choose Permanent (301) and enter the old path and the new full address.

RewriteEngine On
RewriteRule ^old-news/(.*)$ /news/$1 [R=301,L]

Server or application

In Nginx you can redirect HTTP traffic to HTTPS like this:

server {
 listen 80;
 return 301 https://example.ee$request_uri;
}

In PHP, send the header before any HTML and stop the script:

header('Location: https://example.ee/new-page', true, 301);
exit;

After saving, the old URL must respond with a 301 code and the Location header must point straight to a final page with a 200 status.

6. Carry out the SEO migration

On migration day, activate the whole URL map at once and check right away that the new site is accessible.

  1. Switch on the 301 rules.
  2. Use Search Console's Change of Address tool only when changing domain.
  3. Check the robots.txt file and the new XML sitemap.
  4. Crawl the site and test the homepage, a service page and one deeper content page.
  5. Check in Search Console whether Google is finding the new URLs.
  6. Fix 404 errors, chains and wrong final pages before moving on to other work.

7. Remove redirect chains and delays

A redirect chain happens when an old URL passes through one or more intermediate addresses before reaching the final page. In a redirect loop, the URLs point back to each other, so the final page never opens.

  • A chain forms when one page redirects to a second, and that one to a third, instead of straight to the final destination.
  • A loop is when pages keep redirecting back to each other endlessly.

Wrong: /old-service → /service → /new-service

Right: /old-service → /new-service

Check that the old URL reaches a final page with a 200 status in a single hop. Every extra hop creates a new server request and can slow down how fast the page opens.

8. Test before publishing

Test the redirects in a browser and with an automated crawler before publishing. Pick examples from pages that have brought traffic, service or product pages, every page template and URLs with parameters.

Check across the whole mapping table:

  • the HTTP code and Location header;
  • a 200 code on the final page;
  • chains, loops and 404 errors.
  • Only publish once the automated check and the manual test of priority pages are in order. One wrong code or broken target stops the release.

9. Update your site signals

After the migration, update every reference that tells Google where the pages now live:

  • submit an XML sitemap in Search Console that contains only new canonical URLs with a 200 status;
  • remove rules from the robots.txt file that block crawling of the new site;
  • change internal links in the navigation, footer and content to the new URLs;
  • update canonical and hreflang addresses;
  • replace old addresses in the schema fields url, @id, logo and image.
  • Internal links must lead straight to the new page, not into a 301 redirect.

10. Check and monitor the result

Right after publishing, check the main old URLs, internal links, the XML sitemap and Search Console errors. Indexing can vary page by page, so look at overall traffic alongside individual URLs.

View What to check
GSC Pages Indexing and error reasons
GSC Performance Clicks, impressions and landing pages
URL Inspection Final URL and Google's canonical
GA4 Organic traffic landing pages

Run a new check once Search Console shows the new URLs being crawled. Keep going once a month until the important pages are indexed and traffic reaches the right landing pages. This can take a fair while.

Need help with 301 redirects? A technical audit finds the errors

I do a technical audit if you want your redirects checked before publishing or after a migration. The audit finds chains, broken target pages and SEO signals that still point to old URLs.

You get a list of fixes where every issue is tied to a specific URL and a recommended destination.

Need help with 301 redirects?

A wrong redirect can cost you rankings. A technical SEO audit finds redirect chains, broken links and migration errors.

Order an SEO audit

Frequently asked questions

Can I redirect a domain without web hosting?
Yes. Use your registrar's URL redirect or a Cloudflare rule. A Zone URL record lets you choose a 301 or 302 response; test the HTTP and HTTPS addresses separately.
Does a redirect affect email?
An HTTP redirect does not affect email. Problems start when the MX records are changed, so leave them in place and test that mail still arrives after the domain change.
Do external services need updating?
Yes. Update the URLs in ads, analytics, payment services and webhooks. A Stripe webhook must respond directly with a 2xx code, because a 3xx counts as a failed delivery.
Roland Kivitare, SEO expert at Rolevents

Author

Roland Kivitare · SEO expert

I'm Roland Kivitare, SEO expert at Rolevents. I help small and mid-sized companies become visible in Google and AI search.

Join the newsletter

The joys and pains of SEO, case studies and news straight to your inbox. No spam. (Written in Estonian.)

    Built with Kit