Skip to content

.htaccess & Redirect Generator

Generate Apache rewrite rules for HTTPS, www, domain moves and custom redirects without writing them by hand.

Runs in your browser

Updated

Custom redirects (one per line, old-path new-path)

Apache only

These rules are for Apache with mod_rewrite enabled. They do nothing on Nginx or IIS. Always back up the existing file before replacing it.

What Is .htaccess Redirect Generator?

The .htaccess Redirect Generator writes Apache mod_rewrite rules for HTTPS, www or non-www, a domain move, custom redirects and basic security headers. Copy the generated block or download it as an .htaccess file.

Who Uses the .htaccess Redirect Generator?

Web developers and site owners use it to fix canonical host issues, migrate a domain or add a handful of redirects without hand-writing regex.

How to Use the .htaccess Redirect Generator

  1. Choose a preset such as force HTTPS or move to a new domain.
  2. Enter the domain and add any custom old-to-new paths.
  3. Copy the rules or download the .htaccess file.

Why Choose Our .htaccess Redirect Generator?

  • Produces valid mod_rewrite syntax with the right flags
  • Covers HTTPS, www, domain moves and security headers
  • Custom paths are escaped so dots and slashes behave

Try the .htaccess Redirect Generator above - it is free, fast, and works on any device. Bookmark this page to return whenever you need it.

Questions people ask

Will these rules work on Nginx?

No. They are Apache mod_rewrite rules. Nginx uses a different syntax and needs server-block configuration.

Should I use 301 or 302?

Use 301 for permanent moves so search engines transfer signals. Use 302 only for temporary changes you will reverse.