.htaccess Redirect
Generator
Turn a list of old and new addresses into ready-to-paste Apache redirect rules.
Type each old path and its new address on one line, choose 301 or 302 and, if you want, force HTTPS or a www preference. Copy the code into the .htaccess file in your site’s root folder. It suits Apache hosting and should always be tested, with a backup taken first.
Your redirects
Your .htaccess code
This is for Apache servers. Back up your current .htaccess first, add the code near the top, and test every old address in a browser. A mistake can take a site offline, so ask a developer if you are unsure. It does not suit Nginx servers or hosted platforms such as Shopify.
When you need redirects
Redirects send visitors and search engines from an old address to a new one. You need them when you redesign a website, change page addresses, merge pages or move to a new domain. Without them, old links and search results lead to error pages and you lose the value those pages had.
- Use 301 for permanent moves and 302 only for genuinely temporary ones.
- Send each old page to the closest matching new page, not just the homepage.
- Test every old address afterwards, and keep the redirects for a long time.
Planning a move? See our website redesign and migration service and the guide on redesigning without losing rankings.
Frequently Asked
What is a 301 redirect?
A 301 tells browsers and search engines that a page has moved permanently to a new address, so they should use the new one.
Where does the .htaccess file go?
In the root folder of your website on an Apache server, usually next to your homepage file. Back up the existing file before editing it.
Will this work on Shopify or Nginx?
No. It is for Apache hosting. Shopify has its own redirect tool in the admin, and Nginx uses a different format.
Why are query strings not supported?
The simple Redirect rule matches the path only. Redirecting by query string needs a more advanced rewrite rule, best done by a developer.
Need Help Putting This
Into Practice?
Tell us what you need. We reply with an honest recommendation and a clear plan.