Your redirect code
How to use the Redirect Generator
- Choose Page redirects to move individual pages, or Whole-site redirects for HTTPS, www or a domain change.
- Enter each old URL and its new URL on one line. You can paste a list straight from a spreadsheet.
- Pick your server type: Apache (.htaccess), Nginx, or a CSV file for a WordPress redirect plugin.
- Fix any warnings, then copy the code and add it to your site. Test a few old URLs in your browser to make sure they redirect.
301 vs 302: which redirect should I use?
- 301 (permanent): use when a page has moved for good. Google passes the old page’s ranking signals to the new URL. This is the right choice almost every time.
- 302 (temporary): use only when the page will come back, like a short sale or maintenance page.
- 307 and 308 work like 302 and 301, but browsers must keep the same request method. They are mostly used for forms and APIs.
Redirect best practices
- Redirect to the most relevant page, not the homepage. Sending everything to the homepage can be treated as a soft 404.
- Avoid redirect chains (A → B → C). Point every old URL straight to the final page.
- Never create loops, where a URL redirects back to itself.
- Update your internal links to the new URLs, so visitors and Google don’t have to go through the redirect.
- Keep redirects for at least a year, ideally forever, so old backlinks keep working.
Made by Maroof Ahmed. More free tools: SERP Snippet Preview, Keyword Density Checker, Heading Structure Checker, URL Slug Generator, Schema Markup Generator and Robots.txt Generator. Need help with your SEO? Chat on WhatsApp.
When you need a redirect
- You changed a URL, for example from /services-2/ to /services/.
- You deleted a page and have a close replacement.
- You merged two pages that targeted the same keyword.
- You moved domain or platform, such as Wix or Squarespace to WordPress, or HTTP to HTTPS.
Example redirect map for a redesign
Before launching a new site, list every old URL that gets traffic or has backlinks, then match each one to its closest new page: /our-services/ → /services/, /blog/2019/seo-tips/ → /blog/seo-tips/, /team.html → /about/. Paste the pairs into the generator to get the code for your server, then test a sample after launch.
Common redirect mistakes
- Redirecting everything to the homepage. Google often treats this like a missing page. Redirect to the closest matching page instead.
- Redirect chains (A → B → C). Point every old URL straight to the final URL.
- Using 302 for permanent moves. Use 301 when the change is permanent.
- Forgetting internal links. After redirecting, update your menus and links so they point to the new URL directly.
Redirect Generator FAQs
Where do I put the .htaccess code?
In the .htaccess file in your site’s root folder, on Apache or LiteSpeed servers. Always back up the file first. On Nginx, the rules go in your server config instead.
Can I add redirects in WordPress without code?
Yes. A redirect plugin such as Redirection lets you add 301s from the dashboard and also logs 404 errors you may want to redirect.
How long should I keep redirects?
Keep them for at least a year, and longer for URLs that have backlinks. There is little downside to keeping them permanently.
Want an expert to do this for you?
I’m Maroof Ahmed, a freelance SEO consultant with 300+ projects for businesses in the USA, UK and Australia. Website migration SEO service →
