.htaccess Redirect Generator

Pair old paths with new absolute URLs to produce Apache redirect rules with literal source paths escaped.

Your workspace

Server processing

Your entries

Entry 1

1 entries

Import or copy multiple entries

Review the example values, then run the tool.

This utility generates Apache RewriteRule directives for your .htaccess file, allowing you to map legacy URL paths to new destinations. It helps you maintain SEO integrity by ensuring visitors and search engines are correctly routed to updated content.

Generating Redirect Rules

  1. Enter your data in the 'Your entries' record editor, providing the 'Old path' (e.g., /about-us/) and the full 'New absolute URL' (e.g., https://example.com/about/).
  2. Select the appropriate HTTP status code (301 for permanent, 302/307/308 for temporary) and click to generate the rules, which you can then copy directly into your server configuration.

Handling Path Escaping

The generator automatically applies regex escaping to your source paths, ensuring that special characters do not break the Apache configuration. This method ensures that your rules are syntactically correct and safe for production use, preventing common errors associated with manual rule writing.

Example Input and Output

/old-page/,https://example.com/new-page/

RewriteEngine On RewriteRule ^old-page/$ https://example.com/new-page/ [R=301,L]

Questions about Redirect Generation

What happens if my old path contains special regex characters?

The tool automatically escapes the source path, so characters like dots or dashes are treated as literal text rather than regex commands.

Can I use this for relative paths as the destination?

No, the tool requires absolute URLs (including the scheme like https://) for the destination to ensure valid and unambiguous redirect behavior.

Continue your workflow