Htaccess redirect generator
Pick the redirects you need and copy mod_rewrite rules that work together without loops.
- 100% free
- No sign-up
- Runs in your browser
How to use Htaccess redirect generator
- Choose the site-wide rules
- Add your redirects
- Copy into .htaccess
Page redirects
Send one old address to a new one. The old address is a path on this site; the new one is a path or a full address. Chains are shortened and circles refused, but a full address that points back to this site can’t be checked, so make sure it doesn’t loop.
Move the whole site to a new domain
Every page on the old domain, with or without www, goes to the same path on the new one. The file goes on the server that answers for the old domain.
Custom 404 page
The page to show when an address doesn’t exist, as a path on this site.
The download is named htaccess.txt. Rename it to .htaccess and put it in the top folder of your site.
If the site already has an .htaccess file, add these rules near the top of it and keep a copy of the old file. Permanent redirects are remembered by browsers, so test with temporary ones or in a private window first.
Next: Robots.txt generator · URL encode / decode · UTM link generator
Report a problem with this tool
How to use Htaccess redirect generator
Choose the site-wide rules
Switch on Force HTTPS, and choose whether to add or remove www and the trailing slash.
Add your redirects
Enter each old path and where it should go, as a 301 or 302. For a move to a new domain, enter the old and new domain names.
Copy into .htaccess
Copy the rules, or download htaccess.txt and rename it to .htaccess. Put it in the top folder of the site.
Why use Utils365
One hop, no loops
HTTPS and www rules are written so that http://www.example.com reaches https://example.com in a single redirect. Chains of page redirects are shortened to their last stop and circles are refused.
Special characters escaped
Dots, brackets, plus signs and spaces in an old path are escaped for the pattern, so /price-list(v1.2).pdf matches only that file.
Readable output
Each block has a comment saying what it does, with a single RewriteEngine On and the rules in an order that works.
Checked as you type
A path without a leading slash, a duplicate old path or a domain that isn’t one is pointed out and kept out of the file.
Frequently asked questions
What is the difference between a 301 and a 302 redirect?
A 301 is permanent: search engines move the old page’s ranking to the new address and browsers remember it. A 302 is temporary: the old address stays in the index. Use 301 for pages that have moved for good.
Where does the .htaccess file go?
In the top folder of the website, often called public_html, htdocs or www. The name is exactly .htaccess, with a leading dot and no extension. The download is named htaccess.txt because many devices hide or refuse dot files, so rename it after uploading.
Will this work on my server?
It works on Apache with mod_rewrite switched on and .htaccess files allowed, which covers most shared hosting, and on LiteSpeed. It does not work on Nginx or IIS, which use different configuration. The www rules without Force HTTPS need Apache 2.4 or later.
Why do I get a “too many redirects” error after forcing HTTPS?
The site is probably behind a proxy or CDN that handles HTTPS and talks to your server over plain HTTP, so the server always thinks the visit is insecure. Tick “Behind a proxy or CDN” to also check the X-Forwarded-Proto header.
Can I redirect an address with a query string?
Not with this tool. The rules match the path only, so /page?id=5 can’t be used as an old address. The query string of a visit is carried over to the new address unless the new address has one of its own. End the new address with a bare ? to drop it, which needs Apache 2.4.
How do I redirect a whole domain to a new one?
Enter the old and new domains under “Move the whole site”. Every address on the old domain, with or without www, goes to the same path on the new one: old-site.com/about becomes new-site.com/about. The file must be on the server that answers for the old domain.
I already have an .htaccess file. What do I do?
Don’t replace it. Keep a copy, then paste these rules near the top, above blocks added by WordPress or other software. If the file already has RewriteEngine On, one is enough.