Setting up 301 redirects correctly
When you need one
- A page gets a new address.
- A website moves to a new domain.
- Several address variants need to be merged into one (www, http).
- A page is removed, but there is a suitable alternative.
301 or 302?
301 means “moved permanently”, 302 “temporarily moved”. For permanent changes, use 301.
Example for Apache
Redirect 301 /alte-seite.html /neue-seite.html in the .htaccess file.
Rules
- Direct target: From the old address straight to the final one, not via intermediate stops.
- Matching target: To the page that fits the content, not a blanket redirect to the home page.
- No loops: If A redirects to B and B to A, the page becomes unreachable.
- Keep them: Redirects should stay in place for a long time.
Practical example: moving 40 pages
A business changes its address structure from /leistungen/seite.html to /angebot/seite/. Instead of forty individual rules, one pattern rule may be enough, such as RedirectMatch 301 ^/leistungen/(.*)$ /angebot/$1/, although the .html ending still has to be removed from the target address. Where a name changes, the page concerned needs a rule of its own as well. The order matters: individual rules belong before the pattern rules, otherwise the pattern is applied first and redirects incorrectly.
When a redirect is wrong
- Deleted page without a replacement: If there is no target that matches the content, a 410 or 404 status code is more honest. A redirect to the home page can be treated by Google as a so-called soft 404.
- Page that is only temporarily unavailable: A 302 or 307 fits here, because the address will come back later.
- Two pages with the same content: A canonical tag is often the better solution if both addresses are to remain reachable.
Typical mistakes
- Redirect chains: A points to B, B to C. Each intermediate step costs loading time; update A to point straight to C.
- A mix of http, https, www and non-www: Choose one preferred form and redirect all the others to it, in a single step.
- Internal links stay old: Even with a redirect, links within the website should point directly to the new address.
- Redirects removed after a year: Old addresses often still appear in other people’s directories and bookmarks. Only remove rules once the old addresses are no longer used anywhere.
Where to set them up
On Apache servers, the .htaccess file is usually enough. On Nginx, the rules live in the server configuration; with content management systems, plugins or settings often handle them. What matters is that the rule is executed on the server. A redirect via JavaScript or meta refresh is less clear-cut for search engines and should only be used if you cannot access the server.
Checks after the move
- Test a sample of addresses in the browser and by querying the status code, for example with
curl -I. - Check in the Search Console whether error pages or crawling problems appear in the following weeks.
- Update the sitemap to the new addresses.
How long it takes
After a change, search engines need time to pick up the new addresses and replace the old ones. Allow a few weeks, longer for large websites. Fluctuations during this phase are normal. It becomes worrying if important pages are missing altogether after several weeks; in that case it is worth checking the redirects and the robots.txt closely.
Documenting the rules
Keep a list with the old address, new address, date and reason. It helps when someone later asks why a rule exists, and it prevents chains from arising at the next redesign. A simple table is enough. At every relaunch, check the list for rules that lead nowhere.
Testing
Open old addresses and check the status code and the target. For moves, lists of all addresses help. More in Website relaunch.
Questions about “Setting up 301 redirects correctly”?
Briefly describe your case; we will reply personally and honestly, even if the answer is “you don’t need that”. Our service for this: SEO & GEO.
Book an initial consultation