htaccess Redirect Generator
Create .htaccess redirect rules for Apache and LiteSpeed servers. Paste old and new URLs for page redirects, and add HTTPS and www rules in one block of clean, ready-to-paste code.
How to add redirects in .htaccess
- List each redirect as old path | new URL. Add * at the end of a folder path to redirect everything inside it.
- Tick Force HTTPS and choose www if your site needs them.
- Back up your .htaccess file using your hosting file manager.
- Paste the code above the WordPress block, save, and test each old URL in a private window.
301 vs 302 redirects
| Code | Use when | SEO |
|---|---|---|
| 301 | The page has moved permanently | Signals move to the new URL |
| 302 | The move is temporary | Old URL usually stays indexed |
Tips for clean redirects
- Redirect to the closest matching page, not always the homepage.
- Avoid chains: point old URLs straight to the final page.
- Update internal links to the new URLs too.
- On WordPress, the Rank Math Redirections module or a redirection plugin is an easy alternative.
Check your list for chains with the redirect chain checker, use Nginx redirects for Nginx servers, and plan bigger moves with the site migration checklist.
More free tools and guides
Practise tools like this on real projects in our digital marketing course in Faridabad, with weekday, weekend and online batches.
See the courseAll free toolsAsk on WhatsAppFrequently Asked Questions
Is this htaccess redirect generator free?
Yes. It is free with no sign-up and works in your browser.
Does .htaccess work on LiteSpeed servers?
Yes. LiteSpeed reads Apache .htaccess rewrite rules, which many Indian hosts use.
Where do I find the .htaccess file?
In your site's root folder, often public_html. Show hidden files in your file manager to see it.
How long should I keep 301 redirects?
At least a year, and ideally permanently, so old links keep working.