How to set up 301 redirects
A 301 tells search engines a page has permanently moved. Here is how to set one up correctly and what breaks when you get it wrong.
A 301 redirect tells anyone who asks — a browser, a crawler, another server — that a URL has moved permanently and gives them the new address to use instead. It is the correct tool any time a page's address changes for good: a site restructure, a domain change, a URL you are cleaning up, or a page you have merged into another one.
Why the status code matters, not just the destination
A redirect is not just "send the visitor somewhere else" — the HTTP status code attached to it tells search engines how to treat the change. A 301 means permanent: transfer the old URL's ranking signals to the new one and update the index accordingly over time. A 302 means temporary: keep the old URL as the one that matters, because it is coming back. Using a 302 for a change that is actually permanent is one of the most common and easily avoided technical SEO mistakes, because it tells search engines not to bother updating their records for a move you never intend to reverse. See 301 vs 302 redirects for the full comparison.
Setting one up through your control panel
Most hosting control panels include a redirects tool that avoids editing files directly, and it is the more forgiving option if you are not comfortable with server configuration syntax. Look for a section named something like Redirects or URL Redirects, where you enter the old path and the new destination and choose a redirect type — pick Permanent (301), not Temporary.
This is the right choice for a handful of individual redirects. For a large batch, or anything with a repeating pattern, editing the rules directly is faster and easier to review as a whole.
Setting one up in .htaccess
On Apache-based hosting, redirects can be written directly into the site's .htaccess file. A single-page redirect looks like this:
Redirect 301 /old-page.html /new-page/
For anything involving patterns rather than one-to-one page mappings, mod_rewrite is the more flexible tool:
RewriteEngine On
RewriteRule ^old-page\.html$ /new-page/ [R=301,L]
The R=301 flag is what sets the status code; leaving it off defaults to a 302 in most configurations, which is the opposite of what a permanent move needs. The L flag stops any further rewrite rules in the file from running against this same request.
A syntax error in this file can take the entire site down rather than just breaking the one redirect you were adding. Keep a copy of the working file before you change it, and if the site errors immediately after saving, restoring that copy is the fastest fix. See how to trace and fix a redirect loop if a change here produces one.
Redirect to the closest real equivalent
The value of a 301 comes from sending both visitors and crawlers to a page that actually satisfies what they were looking for. Map each retired URL to whichever current page most closely replaces it — a specific product's new listing, an article's new location, a category's new URL — rather than defaulting every old address to the homepage. A visitor sent somewhere unrelated is likely to leave immediately, and that behaviour is itself a weak signal against the page they landed on.
Avoid chains
A redirect chain happens when URL A redirects to B, which itself redirects to C. Each hop adds latency, and a long enough chain can cause some crawlers to give up before reaching the final destination at all. When you retire a page that is already a redirect target, update the original rule to point straight at the final URL instead of stacking a new redirect on top of the old one.
# Instead of chaining:
Redirect 301 /page-a /page-b
Redirect 301 /page-b /page-c
# Point A straight at the final destination:
Redirect 301 /page-a /page-c
Redirect 301 /page-b /page-c
Checking your work
Open the old URL in a private or incognito browser window — your own browser has almost certainly cached the previous behaviour and will not show you a fresh result. Confirm it lands on the intended new page, and check the response is genuinely a 301 rather than a 302, using your browser's developer tools network tab or an online redirect checker if you want to see the raw status code rather than just where you ended up.
It is also worth checking a redirect from more than one location if the site serves visitors internationally, since a caching layer or content delivery network occasionally applies a redirect rule inconsistently between regions until it has fully propagated.
After a larger batch of redirects — following a migration or a site restructure — checking that Google can still crawl the site properly is worth doing as a follow-up, since a mistake in a redirect rule can just as easily block a whole section as move it correctly.
Frequently asked questions
Does a 301 redirect lose ranking value?
A well-implemented 301 to a genuinely equivalent page passes the large majority of the ranking signal the old URL had built up. It is not a perfect, lossless transfer, and Google has said it can take some time for the new URL to be fully credited, but a 301 is by far the best available option when a URL has to change.
How long should I keep an old redirect in place?
Indefinitely, if you can. Links from other sites, bookmarks and old search results can point at a retired URL for years, and removing the redirect turns every one of them into a broken link. Redirects cost almost nothing to maintain, so there is rarely a good reason to delete one.
Can I redirect an entire old site to my new homepage?
You can, but it is close to the weakest option available. A visitor or crawler arriving at an unrelated page is a poor experience and passes little useful signal. Map each old URL to its closest real equivalent wherever you can; only fall back to the homepage for pages that genuinely have no equivalent any more.
Related reading
One says the move is permanent, the other says it is temporary — and search engines treat those two claims very differently.
How to fix duplicate contentMost duplicate content is not copied text — it is the same page reachable at more than one URL. Here is how to find and fix it.
How to migrate a site without losing trafficChanging host does not hurt rankings by itself. A migration that changes URLs or breaks redirects is what actually does the damage.
What is a canonical tag?A line in the page head that tells search engines which of several similar URLs is the one that should actually be indexed.