How to Set Up 301 Redirects When URLs Change

White and black One Way-printed road signages

When the address of a page changes, everything that pointed to the old address breaks: links from other websites, bookmarks, search results. A 301 redirect solves this by sending visitors and search engines from the old address to the new one automatically. This tutorial shows how to plan, create and test redirects.

What a 301 redirect is

A redirect is an instruction from the server that says this page has moved. The number is the status code.

  • 301 means moved permanently. Search engines transfer the old page’s signals to the new address over time. Use it for lasting changes.
  • 302 means found, a temporary move. Use it only when the old address will return, for example during a short campaign.

For a changed URL, a renamed page, a merged article or a new domain, 301 is the correct choice.

When you need redirects

  • You change a page’s slug or the permalink structure.
  • You delete a page that has a suitable replacement.
  • You merge two articles into one.
  • You move from http to https, or between www and non-www.
  • You move the site to a new domain.
  • You redesign and the page structure changes.

Step 1: List the old addresses

Before making changes, collect the current addresses. Use your sitemap, the list of pages in Search Console, an export from your CMS, or a crawl of the site. For a redesign or migration, this list is essential. The Website Content Inventory Template gives a format.

Step 2: Map each old address to a new one

Create a two-column table: old address, new address.

  • Send each old page to the page that best replaces it, not to the homepage. Mass redirects to the homepage frustrate visitors and are treated by search engines much like missing pages.
  • If no reasonable replacement exists, let the old address return 404 or 410.
  • Point directly to the final address. If A already redirects to B and B is moving to C, update A to point to C.

Step 3: Create the redirects

Choose the method that fits your setup.

In WordPress with a plugin

A redirect manager plugin, or the redirect feature of your SEO plugin, lets you enter the old path and the new address in a form. This is the simplest and safest method for most site owners. WordPress also creates a redirect on its own when you change the slug of a published post, but do not rely on that for larger changes.

On an Apache server with .htaccess

Add rules to the .htaccess file in the site root. Back the file up first, because an error here can take the site offline.

Redirect 301 /old-page/ https://www.example.com/new-page/

On an Nginx server

Rules go in the server configuration, which usually requires your host or developer:

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

On hosted platforms

Website builders and shop platforms have a URL redirects section in their settings where you enter old and new paths.

Step 4: Test

  1. Open the old address in a private browser window. You should arrive at the new page.
  2. Check the status code with your browser’s developer tools on the Network tab, or with an online redirect checker. It should show 301, followed by 200 for the final page.
  3. Confirm there is only one hop. A chain of several redirects slows visitors and may not be followed to the end.
  4. Test with and without the trailing slash, and with www and non-www.
  5. Test a sample of every type of page, not only the homepage.

Step 5: Update what you control

Redirects are a safety net. Wherever you can, fix the source.

  • Update internal links, menus and buttons to the new addresses. See How to Find and Fix Broken Links on Your Website.
  • Make sure the sitemap lists only the new addresses.
  • Update canonical tags.
  • Change links in your business profiles, social accounts and email signatures.

Step 6: Monitor and keep them

  • Watch the Page indexing report in Search Console for Not found errors over the following weeks.
  • Keep redirects in place for at least a year. If other sites still link to the old addresses, keep them permanently.
  • For a move to a new domain, also use the Change of Address tool in Search Console.

Common mistakes

  • Using 302 for a permanent change.
  • Redirecting every old page to the homepage.
  • Redirect chains and loops, where A points to B and B back to A.
  • Forgetting to redirect both the www and non-www versions.
  • Removing redirects after a few weeks.
  • Changing addresses without a list of what existed before.

Next step

If the address change is part of a bigger move, work through the Website Migration Checklist. To decide on a URL structure that will not need changing later, see How to Choose WordPress Permalinks Before Your Site Launches.