Htaccess Redirect Generator
Generate correct .htaccess rules for 301/302 redirects, www/non-www, HTTPS enforcement, trailing slashes and domain moves.
return 301 / rewrite directives instead.Redirect 301 /old-page.html https://example.com/new-page/
Website Management Tools
About the Htaccess Redirect Generator
This tool writes .htaccess rules for Apache servers without you needing to learn the syntax. It covers 301 and 302 single-page redirects, forcing HTTPS, choosing www or non-www, and moving a whole site to a new domain.
A 301 is permanent and tells search engines to move a page's value to the new address, while a 302 is temporary. Forcing one version of your site, such as https without www, also avoids the same pages being reachable at several addresses.
A wrong rule can cause a redirect loop or take your site offline, so download a copy of your existing .htaccess before you edit it. These rules work on Apache and LiteSpeed servers. Nginx uses a different format and ignores this file.
How to use this tool
- 1Choose the redirect type.
- 2Enter the old path and new address, or your domain.
- 3Copy the rules it generates.
- 4Back up your .htaccess, add the rules at the top and test the address.
Best-practice tips
- Use a 301 when a page has moved for good.
- Redirect to the most relevant page, not always to the home page.
- Test with the Redirect Checker, and avoid chains of several redirects.
Answers
Htaccess Redirect Generator FAQs
A 301 means the move is permanent. A 302 means it is temporary and the old address may return.
Usually in your site's main folder, often public_html. It may be hidden, so turn on "show hidden files" in your file manager.
It is when rules send a visitor round in a circle, so the page never loads. Remove the new rules and check for conflicts.
Related tools
Continue with these related website management tools.
Website SEO Score Checker
Get an instant SEO score out of 100 with a detailed breakdown of title, meta, headings, images, links, social tags and technical signals from the live page.
Website Ping Test
Ping any website: measure real response times from your browser and check whether the server is online, with its HTTP status and redirects.
Website Page Speed Checker
Measure real load timing for any page: response time, HTML size, code-to-text ratio, resource counts and Core Web Vitals-style recommendations.