↪️ .htaccess Redirect Generator

Generate Apache .htaccess redirect rules. Support 301, 302, and URL rewrites — all in your browser, no upload, instant results.

About the .htaccess Redirect Generator

This generator runs entirely in your browser. Pick a redirect type, add as many from→to URL pairs as you need, toggle the common www and HTTPS rules, and the tool produces ready-to-paste Apache directives for your .htaccess file. Nothing is uploaded — all generation happens locally with JavaScript on your device.

Redirect status codes

  • 301 Permanent — The resource has permanently moved. Search engines update their index to the new URL. Best for site migrations.
  • 302 Temporary — The resource is temporarily elsewhere. Search engines keep the original URL indexed. Use for short promotions or A/B tests.
  • 303 See Other — Tells the client to fetch the new URL with a GET request. Common after form submissions.
  • 307 Temp Redirect — Like 302 but preserves the original HTTP method (POST stays POST).
  • 308 Permanent Redirect — Like 301 but preserves the HTTP method.

Common rules

  • Force www to non-www — Strips the www. prefix from requests.
  • Force HTTPS — Redirects all HTTP traffic to HTTPS.

How to use the generator

  1. Select the Redirect type for the path-based rules.
  2. Add one or more rules with the Add Rule button — each row is a from-path → to-URL pair.
  3. Tick Force www to non-www and/or Force HTTPS if you want those rules included.
  4. Click Generate then Copy, and paste the output into the .htaccess file at the root of your Apache site.

Frequently asked questions

Does this tool upload my data? No. Everything happens locally in your browser. Your inputs never leave your device.

Will this work on Nginx or IIS? No. The generated directives use Apache mod_rewrite syntax. Nginx uses its own rewrite directive, and IIS uses web.config.

What if my redirect loops forever? A loop usually means the rule matches its own target. Make sure the from-path does not match the to-URL, and that HTTPS rules only fire when the request is HTTP.

Do I need mod_rewrite enabled? Yes. The generated rules use RewriteEngine On and RewriteRule directives. Most Apache hosts enable mod_rewrite by default.