Code · Made a little simpler

.htaccess Redirect Generator

Build single or batch Apache .htaccess redirects. Check case-sensitive exact and prefix rules, review overlaps, and copy or download the configuration.

Free to useNo account neededProcessed on your device
Your workspaceProcessed on your device

Enter status, exact or prefix, source path and destination per line. Separate fields with spaces or tabs. Rules match case-sensitively and run in line order.

For a document-root .htaccess file. Enable Apache mod_alias and allow the FileInfo override. Prefix rules carry the remaining path to the destination.

Inputs and output stay on this device.

Add this tool to your website

Paste this code into your page to add the tool and a visible ToolMellow credit link.

HTML embed code
Preview embed

.htaccess Redirect Generator: how to use it

  1. Enter one rule per line with the status code, exact or prefix, the source path and the destination. Load the example to see both rule types.
  2. Generate the rules. Check line-specific errors, first-match overlaps and destinations that may lead back into the rule set.
  3. Copy the rules into .htaccess or save the htaccess.txt download as .htaccess. Test on Apache with mod_alias enabled and the FileInfo override allowed.

Limits and notes

Supports up to 100 case-sensitive rules using status 301, 302, 307 or 308, plain ASCII source paths and HTTP(S) or same-site destinations. Prefix rules require source and destination paths without trailing slashes. The output targets the document-root .htaccess file. Overlap checks cover the rules you enter.

How your privacy works →

.htaccess Redirect Generator: common questions

What is the difference between exact and prefix?

Exact matches one URL path. Prefix matches full path segments and appends any unmatched path to the destination.

Which redirect codes preserve the request method?

307 and 308 instruct clients to preserve the method when following the redirect. 307 is temporary and 308 is permanent.

Which rule wins if both match?

Apache’s mod_alias uses the first matching rule in the same context. Put a more specific rule before a broader one.

Guides