Redirect Rules Generator
List the old addresses and where they should go, choose any common rules, then copy the Apache or nginx code.
Deze inhoud is in het Engels.
For example: example.co.uk. Needed for the HTTPS and www rules.
One redirect per line: the old path, a space, then the new address. For example: /old-page /new-page
Test before using. Try these rules on a copy of your site first. A wrong rule can send visitors to the wrong page or cause a loop.
Uitgewerkte voorbeelden
Permanent move of one page
Old path /old-page moved permanently to /new-page
Redirect 301 /old-page /new-page
A 301 is the usual choice for permanent moves; the exact syntax depends on the server format selected.
Temporary sale page
Old path /sale sent temporarily to /summer-sale
Redirect 302 /sale /summer-sale
A 302 is temporary, so the original address is expected to return after the sale.
Over Redirect Rules Generator
A redirect sends visitors and search engines from an old address to a new one. You need them when you move a page, rename a file, change your domain or tidy up old links, so that people who follow an old link still arrive somewhere useful. This generator takes a list of old and new addresses and writes the rules for the two most common web servers, Apache and nginx. You can also add rules that send all visitors to the HTTPS version of your site, pick one version of your address with or without www, and make addresses end with or without a slash.
Redirects have a cost if they are set up badly. Chains of redirects slow visits down, and a loop, where one address sends visitors back to itself, leaves people with an error page. A 301 redirect tells search engines the move is permanent, so it is the usual choice, while a 302 says the move is temporary. Before you use the code on your live site, test it on a copy, check a few old addresses by hand, and keep a note of what you changed. Your web host may run its own setup, so the code may need small changes to fit it.
Zo gebruikt u Redirect Rules Generator
- Enter your domain, such as example.co.uk, if you want the HTTPS, www or slash rules.
- List each old path on its own line, followed by a space and the new address.
- Choose a redirect type. Use 301 for permanent moves and 302 for temporary ones.
- Pick any common rules you need, then check the message box for any lines that need fixing.
- Copy the Apache or nginx code, test it on a copy of your site, then add it to your live site.
Veelvoorkomend gebruik
- Moving a page to a new address after a redesign
- Sending every visitor to the HTTPS version of your site
- Choosing whether your site uses www or not
- Keeping old links working after a page is renamed
Veelgestelde vragen
What is the difference between a 301 and a 302 redirect?
A 301 redirect tells browsers and search engines that a page has moved for good, and search engines usually pass the standing of the old address on to the new one. A 302 redirect says the move is temporary, so the old address is expected to come back. Use 301 for most site changes, and only choose 302 when you know the original page will return.
Which file do I paste the Apache code into?
Put the Apache code into the .htaccess file in the main folder of your site, or ask your web host where the file should go. Keep the lines inside the IfModule block, as the rules only run on servers that support them. If your host gives you a control panel with a redirect tool, you can also enter the same old and new addresses there.
Where does the nginx code go?
The nginx code goes into the server settings for your website. The first part is a separate block for plain HTTP visitors, and the second part sits inside the main block that serves your site. Your host or developer may need to place it for you. Check the result with a few test addresses before you save the change to the live site.
Why do I need to enter my domain?
The HTTPS and www rules compare visitors' addresses with the one you want to keep, so they need to know your domain. Without it, the tool cannot tell which version of your address is the right one. Page moves work without a domain, so you can leave the box empty if you only need to move individual pages.
Can a redirect cause a loop?
Yes. A loop happens when two rules keep sending a visitor back and forth, for example if one rule adds a slash and another removes it. This generator puts the HTTPS and www choices into a single rule so visitors make one jump, but you should still test a few addresses after publishing. If a page never loads, remove the most recent rules and check the list again.