301 Redirect Generator
Build clean 301 redirect rules for your .htaccess file. Use after URL changes, site migrations, or content reorganization.
Paste old → new pairs
One pair per line. Old path then new URL, space separated.
Choose 301 or 302
301 is permanent (preserves SEO). 302 is temporary.
Paste in .htaccess
Add rules to your Apache .htaccess file in site root.
Build redirects
301 vs 302 redirects — when to use which
301 is a permanent redirect. It tells Google "this page has moved forever to the new URL, transfer ranking signals." 302 is temporary — Google keeps the old URL in its index, expecting the redirect to be removed.
Common use cases
- Renamed page: 301 from old path to new path.
- Domain change: 301 every old URL to corresponding new domain URL.
- HTTPS migration: 301 all http:// to https:// versions.
- Trailing slash standardization: 301 /page to /page/ or vice versa.
- Maintenance redirect: 302 visitors to a maintenance page (temporary).
Frequently asked questions
Does a 301 redirect pass SEO ranking?
Yes, almost all of it. Google has confirmed 301 redirects pass 100% of PageRank.
Where do I put .htaccess?
In the root of your website. If using a CMS like WordPress, it usually already exists.
How long should I keep redirects?
Forever if possible. Old URLs may still be linked from external sites; removing the redirect creates broken links.
Can I redirect with PHP instead of .htaccess?
Yes, but .htaccess is faster (runs before PHP loads) and works for all file types including static files.
What if I redirect to a 404 page?
Bad. Use a 410 Gone status instead, or redirect to a relevant alternative page.