Home | Free SEO Tools | 301 Redirect Generator

301 Redirect Generator

A permanent redirect looks simple until the matching rules are misunderstood. An overly broad rule can redirect URLs you never intended to move. A chain can add unnecessary requests. A loop can make a section of the site unusable. A rule placed in the wrong context may not run at all.

The Wild Creek 301 Redirect Generator creates a small, reviewable Apache snippet from one source URL or path and one absolute destination URL. It deliberately defaults to an anchored `RewriteRule` because that makes one-to-one path matching explicit.

The generated code is a starting point for deployment, not a guarantee that it will behave correctly in every Apache configuration. Always review and test it on the real server.

301 Redirect Generator

Generate a conservative Apache rule for one old path. Exact RewriteRule matching is the default. Always back up and test your .htaccess file before deploying a redirect.

If you paste a full URL, only its path is used for the rule.
Apache Redirect uses prefix matching. Use the exact options when moving one URL only.
Deployment notes
  1. Back up the existing .htaccess file.
  2. Place specific redirect rules before broader WordPress rewrite rules.
  3. Do not mix mod_alias and mod_rewrite casually in the same migration set. Pick one approach where practical.
  4. Test the old URL, trailing-slash variant, query-string behavior and an unrelated URL before publishing widely.
  5. Use 301 only for a genuinely permanent move.

Available rule types:

– Exact RewriteRule 301 – the recommended default for redirecting one old path to one destination.
– Exact RedirectMatch 301 – an anchored mod_alias regular-expression rule.
– Prefix Redirect 301 – a mod_alias Redirect rule. This is prefix matching, not an exact one-to-one match.

Why Plain Redirect Is Called Prefix Redirect

Apache’s `Redirect` directive matches a URL-path prefix. If you configure a source such as `/old`, a request for `/old/child` can also match, and Apache can append the unmatched suffix to the destination.

That behaviour is useful when you deliberately want to move a whole path tree. It is not the safest default when you mean to move only one URL.

For a single page migration, use the exact RewriteRule or exact RedirectMatch option unless prefix behaviour is genuinely what you want.

Exact RewriteRule

The default RewriteRule anchors the generated pattern so that it matches only the intended path. Regex metacharacters in the source are escaped, but ordinary hyphens remain unescaped because they do not need escaping outside a character class. You can optionally allow both trailing-slash variants, add case-insensitive matching with `NC`, or discard an incoming query string with `QSD`.

`QSD` requires Apache 2.4 or newer. Use it only when the old query string should not be carried to the destination. Tracking and functional query parameters may contain useful information, so dropping them should be a deliberate decision.

Exact RedirectMatch

RedirectMatch uses mod_alias with a regular expression. The generated rule escapes the supplied source path and anchors it at both ends so that the match remains exact. This can be useful when a site already manages redirects with mod_alias.

Do not assume options from RewriteRule also apply to RedirectMatch. The tool warns when an option belongs only to mod_rewrite.

Where to Put the Rule

The correct location depends on the server configuration. On many WordPress sites using Apache and a root `.htaccess` file, specific redirect rules are placed before WordPress’s catch-all rewrite block so that the redirect runs before WordPress routes the request.

That is not universal. Hosts can manage redirects at the virtual-host, control-panel, CDN or reverse-proxy layer. If a site already has an established redirect system, use that system rather than adding a second competing layer simply because this tool produces `.htaccess` syntax.

301 Does Not Mean “SEO Preserved Automatically”

A 301 tells clients that the resource has moved permanently. Search engines can use that signal when processing the old and new URLs, but a redirect does not guarantee identical rankings, traffic or indexing after a migration.

Successful migrations also depend on the relevance of the destination, internal-link updates, canonical signals, sitemaps, server consistency and the overall quality and purpose of the new URL.

Redirect Chains

Whenever possible, redirect an old URL directly to its final destination. If A redirects to B and B redirects to C, users and crawlers must make an additional request. Long or accidental chains make migrations harder to debug and can slow navigation.

After deploying a rule, test:

1. The exact old URL.
2. The trailing-slash variant if relevant.
3. A child URL that should not redirect.
4. An unrelated URL.
5. Query-string behaviour.
6. The final HTTP status and destination.

Back up the existing configuration before editing `.htaccess`.

FAQs

Frequently Asked Questions

Is Redirect 301 an exact match?

No. Apache’s Redirect directive uses prefix matching. That is why this generator labels it Prefix Redirect and defaults to an exact RewriteRule for one-to-one moves.

Do hyphens need to be escaped in the generated RewriteRule?

No. Ordinary hyphens outside a regular-expression character class do not need to be escaped. The generator now leaves them as plain hyphens while continuing to escape characters that are meaningful to the regular expression.

What is the difference between RedirectMatch and RewriteRule?

RedirectMatch belongs to mod_alias and accepts a regular expression. RewriteRule belongs to mod_rewrite and supports a different matching context and flags such as NC and QSD. Use the module that fits the rest of your server configuration.

Should every old URL be redirected?

Redirect an old URL when there is a relevant replacement or when the move is part of a deliberate migration. Redirecting unrelated old pages to a homepage or generic category can create a poor user experience and may not preserve the signals you expect.

Does a 301 preserve all rankings and link equity?

A 301 is the correct permanent-move signal, but search performance after a migration depends on more than the status code. The relationship between the old and new content and the rest of the migration signals matters.

What does QSD do?

The Query String Discard flag tells Apache mod_rewrite to drop the incoming query string when the substitution does not supply a new one. It is available in Apache 2.4 and newer.

Can I use these rules on Nginx?

No. The generated directives are for Apache. Nginx, IIS, CDN products and hosting control panels use different redirect syntax or configuration interfaces.