.htaccess Redirect Generator
Generate .htaccess code for 301 redirects, HTTPS and www or non-www rules.
How to use the .htaccess Redirect Generator
- 1Tick the rules you needHTTPS and www settings are the most common.
- 2Add old → new redirectsOne per line.
- 3Copy into .htaccessBack up your current file first, then test your site.
What is the .htaccess Redirect Generator?
On cPanel and other Apache hosting, the .htaccess file controls redirects. This generator writes correct code to force HTTPS, choose www or non-www, hide .php, remove trailing slashes, add 301 redirects for moved pages and set a custom 404 page.
Choose the rules you need, add old and new URLs and copy code that works on cPanel and Apache hosting.
When to use it
- Moving a site to HTTPS.
- Redirecting old URLs after a redesign.
- Cleaning up URLs on PHP sites.
Tips for the best result
- Always keep a copy of the old .htaccess; one typo can stop the whole site loading.
Questions
What is a 301 redirect?
A permanent redirect that sends visitors and search engines to the new address and passes most of the old page's ranking signals.
Is the .htaccess Redirect Generator free?
Yes. It is completely free with no sign-up and no watermark. Use it as often as you like.
Are my files uploaded to your server?
No. This tool runs inside your browser, so your files and text stay on your own phone or computer.
Does it work on mobile?
Yes, it works in Chrome, Safari and other modern browsers on Android, iPhone, Windows and Mac.
Need the full premium tools?
Get Ahrefs, Semrush, ChatGPT Plus, Canva Pro and 50+ more premium tools at group-buy prices. Pay with bKash, Nagad, Rocket or card and get access in minutes.
Ahrefs$7.38/30 Days
semrush$2.45/30 Days
ubersuggest$2.70/30 Days
brightlocal$3.69/30 Days
neuronwriter$3.69/30 Days
morningscore$2.46/30 Days
