Create .htaccess rules for 301 redirects, HTTPS and www without learning mod_rewrite.
🔒 Generated in your browser.
How to use the .htaccess redirect generator
- Tick Force HTTPS and choose a www rule.
- List old and new paths, one pair per line.
- Paste the code at the top of your .htaccess file.
301 or 302?
Use 301 for permanent moves – it passes ranking signals to the new URL. Use 302 only for temporary changes such as a seasonal page.
Before you edit
Download a copy of your current .htaccess first. A typo can take the whole site down with a 500 error; restoring the backup fixes it instantly.
Frequently asked questions
Does this work on Nginx?
No – .htaccess is for Apache and LiteSpeed servers. Most shared hosting uses one of them.
Where is .htaccess?
In your site's root folder (public_html). It is a hidden file – enable 'show hidden files' in your file manager.
How do I test redirects?
Use the Redirect Checker to see every hop and status code.