.htaccess Redirect Generator

Build Apache 301 and 302 redirect rules, compare their paths and directives in Three.js, then save the .htaccess text.

  • File & Data
  • Runs in your browser
  • Free, no signup

How to use

How to Use .htaccess Redirect Generator

  1. 1

    Enter the old URL

    Type the source URL path you want to redirect from.

  2. 2

    Enter the new URL

    Type the destination URL path to redirect to.

  3. 3

    Select redirect type

    Choose 301 permanent or 302 temporary redirect.

  4. 4

    Copy the rule

    Click copy to grab the .htaccess redirect rule.

The guide

Tested tool guide Tested browser tools Checked November 30, 2026

What .htaccess Redirect Generator does, with a checked example

Enter the old path and destination for each page move, then choose prefix or exact-path syntax. Review the generated Apache directives, then copy or download the configuration for your server.

Worked example

A concrete input and expected output from the current implementation.

Input

Select Exact RewriteRule and enter /docs/start.html -> /intro -> 302.

Expected output

The configuration begins with RewriteEngine On and includes RewriteRule ^docs/start\.html$ /intro [R=302,L].

In a root .htaccess file the pattern omits the leading slash. Escaping the period keeps it literal.

How the result is produced

1

Enter the moved paths

Use one source and destination pair per line, separated by an arrow, tab, comma, or space. Add a row-specific 301 or 302 if it differs from the selected default.

2

Choose the matching mode

Prefix Redirect uses mod_alias and also matches subpaths. Exact RewriteRule uses mod_rewrite and escapes source path punctuation for a literal match.

3

Inspect the configuration

Review unsupported rows and confirm that destinations point to the intended paths. The Three.js view shows the entered pairs and first directives. Download or copy the configuration text.

Good uses

  • Prepare redirect directives during a site migration.
  • Keep an old page link working after a rename.
  • Generate a small set of temporary redirects for a planned move.

Limits and checks

  • Use a root .htaccess file for the generated exact-path patterns.
  • Check that the relevant Apache module and override settings are enabled.
  • Test for an unintended redirect loop or a conflicting earlier rule before deployment.

Common questions

How does prefix mode handle a subpath?

Apache matches the prefix at a path segment boundary and appends the remaining path to the destination.

Can I use an HTTP or HTTPS destination?

Yes. A destination can be a simple root-relative path or an HTTP(S) address with supported punctuation.

References and verification

The example and behavioral notes were checked against the browser implementation. Standards and primary references below define the relevant format, formula, or platform behavior.