How to Set Up 301 Redirects When You Change a URL
You tidy up your site. A page called /services-page-2 becomes /web-design , an old blog post gets a cleaner address, and a category disappears altogether. Everything looks better.

You tidy up your site. A page called /services-page-2 becomes /web-design, an old blog post gets a cleaner address, and a category disappears altogether. Everything looks better. Then, a few weeks later, Search Console reports a pile of 404 errors, a page that used to bring in 40 visits a day has vanished from search results, and someone emails to say a link in your newsletter goes nowhere.
That is what happens when URLs change without redirects. Search engines and visitors still know the old address, and when it stops working, the trust and links the page built up go with it. A 301 redirect fixes this by telling every browser and crawler that the page has moved permanently and where it lives now. Setting one up takes a few minutes, but there are a few details that decide whether it actually works.
What a 301 redirect does
When a browser asks for a URL, the server replies with a status code. A 200 means "here is the page." A 404 means "nothing here." A 301 means "this page has moved permanently, go to this other address instead," and it includes the new location.
The browser follows the redirect automatically, usually in a few milliseconds, and the visitor lands on the new page without noticing. Search engines do something similar: they note the move, update their index over the following days or weeks, and pass most of the ranking signals, including backlinks, from the old address to the new one.
A 302 redirect looks the same to visitors but means "moved temporarily." Search engines keep the old URL in their index because they expect it to come back. For a permanent change of address, which is nearly every case on a small site, you want a 301.
When you need one
Any time a URL that has been public changes, you need a redirect from the old one to the new one. That includes renaming a page slug, moving from http to https, switching between www and non-www, merging two thin articles into one, deleting a page that has a close replacement, and moving to a new domain.
If you are planning URL changes, our guide to writing SEO friendly URLs can help you choose addresses that will not need changing again.
How to set up 301 redirects, step by step
The exact method depends on your hosting, but the process is the same everywhere.
- List every URL that is changing. Write the old path and the new path side by side in a spreadsheet. Include old URLs that appear in Search Console, your analytics and any backlink tool you use.
- Match each old URL to the closest new page. Redirect to the most relevant page, not the homepage. A redirect from a deleted article about image compression should go to your current image optimisation guide, not to
/. - Add the redirects on the server. On Apache hosting, add lines to the
.htaccessfile in your site's root, such asRedirect 301 /services-page-2 /web-design. On Nginx, add areturn 301rule inside the server block. On Netlify or Cloudflare Pages, add lines to a_redirectsfile. On WordPress, a redirect plugin such as Redirection does the same job without touching files. - Test each redirect. Open the old URL in a private browser window and confirm it lands on the right page. Then check the status code with a free header checker or your browser's developer tools, under the Network tab. You should see 301 followed by 200.
- Update internal links. Change every link inside your own site to point straight at the new URL. Redirects work, but every hop adds a little delay and wastes crawl time.
- Submit the new URLs. Update your XML sitemap so it lists only the new addresses, and request indexing for the most important pages in Search Console.
- Watch the reports for a month. Check the Pages report in Search Console weekly. Old URLs should move to "Page with redirect" and new ones should appear as indexed.
If you are not yet set up there, our walkthrough on setting up Google Search Console takes about fifteen minutes.
Where common redirect advice goes wrong
One piece of advice gets repeated in forums and plugin documentation: if a page is deleted, redirect it to the homepage so you do not lose any link value. On a small site, that is usually a mistake.
Google treats redirects to an unrelated page, especially the homepage, as soft 404 errors in many cases. The signals from the old page are not passed on, and visitors who clicked a link expecting a specific article land on a generic page and leave. You lose the link value anyway, and you add a confusing experience on top.
If a deleted page has a genuinely related replacement, redirect it there. If it has no replacement, let it return a 404 or a 410, and make sure your 404 page helps people find something useful. A clean 404 is better than a misleading redirect. I would rather see ten honest 404s in a report than ten homepage redirects quietly classed as soft errors.
The other questionable habit is leaving redirects in place for only a few months. Search engines usually process a move within weeks, but backlinks on other sites, old bookmarks and links in emails can keep sending traffic for years. Keep 301s for at least a year, and for important pages, indefinitely. A few hundred redirect rules have no measurable effect on speed for a typical small site.
Redirect chains and loops
A redirect chain happens when URL A redirects to B, which redirects to C. Each hop adds a round trip, often 50 to 200 milliseconds on shared hosting, and search engines may stop following after several hops. Chains usually appear when a page has been renamed more than once. Fix them by pointing A straight to C.
A loop happens when A redirects to B and B redirects back to A, or when a rule matches its own target. Browsers show an error such as "too many redirects," and the page is unreachable. Loops are common after an https or www change, when a hosting panel setting and an .htaccess rule both try to force the same thing. Turn one of them off.
A crawler such as Screaming Frog, which is free for up to 500 URLs, will list chains and loops for you. So will the broken link checks described in our guide on finding and fixing broken links.
Redirects during a host or domain move
When you move to a new host but keep the same domain, URLs usually stay the same, so no redirects are needed as long as the file paths match. Check a sample of pages after the move anyway. Compare page counts in your old and new sitemaps before you switch the DNS, so nothing gets left behind.
When you move to a new domain, every URL on the old domain needs a 301 to the matching URL on the new one, page to page. Keep the old domain registered and the redirects active for at least a year, and use the Change of Address tool in Search Console to tell Google about the move.
FAQ
Do 301 redirects hurt SEO?
Not when they point to a relevant page. Google passes ranking signals through 301s. Problems come from chains, loops and redirects to unrelated pages.
How long should I keep a 301 redirect?
At least a year, and indefinitely for pages with backlinks. Old links and bookmarks keep sending visitors long after search engines update.
What is the difference between a 301 and a 302 redirect?
A 301 is permanent and tells search engines to replace the old URL. A 302 is temporary, so search engines keep the old URL indexed.
Can too many redirects slow down my website?
A few hundred rules have no noticeable effect on a small site. Chains of several redirects in a row do add delay, so point old URLs straight to the final page.
More in SEO
SEO
How to Write a robots.txt File for a Small Website
Someone on a forum tells you your site needs a robots.txt file, so you paste in a block of rules you found, upload it, and move...
SEO
How to Fix Crawled Currently Not Indexed Pages in Google
You open the Pages report in Google Search Console and find 37 URLs sitting under "Crawled, currently not indexed." Google...
SEO
How to Write SEO Friendly URLs for a Small Website
You publish a new page, glance at the address bar and see something like /index.php?p=4823 or...