Toolstia / .htaccess redirect generator
.htaccess redirect generator
List your old and new addresses, one redirect per line, and choose whether to force HTTPS or add or remove www. The tool writes the .htaccess code for Apache servers.
This works on Apache servers, including most shared hosting and WordPress hosts. Add the code to the .htaccess file in your site’s root folder, and keep a backup of the old file. Use 301 for permanent moves and 302 for temporary ones. Nginx and other servers use a different syntax.
How it works
- Type one redirect per line: the old path, then the new path or URL.
- Choose the HTTPS and www options.
- Copy the code into your .htaccess file.
Writing redirects
Use a line like /old-page /new-page. Add 302 at the end for a temporary redirect. The default is 301, a permanent one. You can also write the lines with an arrow, such as /old -> /new.
Force HTTPS
This sends every http:// visit to the https:// version of the same address with a 301 redirect.
www rules
Pick one version, with or without www, and the other redirects to it. This avoids duplicate versions of your site in search results.
Before you save
Keep a backup of your current .htaccess. A mistake can take the site offline until it is fixed. This works on Apache and compatible servers, not on Nginx.
Questions
What is the difference between 301 and 302?
301 means the page has moved for good and passes its search ranking to the new address. 302 means a temporary move.
Will it work on WordPress?
Yes, on Apache hosting. Put the rules above the WordPress block in the file.
Is my data stored?
Everything happens in your browser, and nothing you enter is sent anywhere.