HTAccess Redirect Generator
Generate .htaccess redirect rules for Apache, including 301/302 redirects, forced HTTPS, and www enforcement. Runs entirely in your browser.
🔒 This tool runs entirely in your browser. Your files are never uploaded to a server.
How the .htaccess redirect generator works
- Enter the path you want to redirect from and the destination URL.
- Choose a 301 (permanent) or 302 (temporary) redirect, and toggle www/HTTPS enforcement.
- Copy the generated Apache rewrite rules into your .htaccess file.
FAQ
What is a .htaccess file?
It's a configuration file used by Apache web servers to control things like redirects, URL rewriting, and access rules on a per-directory basis.
What is the difference between a 301 and 302 redirect?
A 301 tells search engines and browsers the move is permanent, transferring most SEO value to the new URL. A 302 signals a temporary redirect and keeps the original URL indexed.
Why would I force HTTPS or www?
Forcing HTTPS ensures visitors always use an encrypted connection. Forcing www (or non-www) keeps your site consistent under a single canonical domain, which helps avoid duplicate-content SEO issues.
Where do I put the generated rules?
Paste them into the .htaccess file in your site's root directory on an Apache server. Nginx uses a different syntax and won't read this file.
How we compare
| Feature | Online Tool Store | Hand-writing rules | Hosting panel redirect UI |
|---|---|---|---|
| Correct RewriteCond syntax | ✓ | ✗ | ✓ |
| Combines www + HTTPS + path redirect | ✓ | ✗ | ✗ |
| No hosting account required | ✓ | ✓ | ✗ |
Useful for migrating URLs, enforcing HTTPS, or standardizing on www vs non-www without memorizing Apache rewrite syntax.