301 Redirect Generator

Moved a page and need the old address to keep working? Pick what you are redirecting, type the two addresses, and copy the rule. Nothing is sent anywhere, this runs in your browser.

Apache or LiteSpeed (.htaccess) Most hosts

Paste this ABOVE the line that says # BEGIN WordPress. Rules placed after it never run.

Nginx

Goes inside the server block. Nginx has no .htaccess, so this needs server access or a host that offers a rules field.

Redirection plugin No file editing

Safest option if you would rather not touch server files. Tools > Redirection in wp-admin.

301 or 302, and why it matters

A 301 says the move is permanent. Search engines transfer the old page’s ranking to the new one and eventually drop the old address from their index. Browsers remember it too.

A 302 says the move is temporary. Nothing is transferred and the old address stays indexed.

Use 301 for almost everything. Use 302 only when the old address really is coming back, such as a page redirected during maintenance or a seasonal offer.

One warning about 301s: browsers cache them hard, and Chrome will keep redirecting you long after you have deleted the rule. If you are testing, use a private window, or test with 302 first and switch to 301 once you are sure it is right.

Where the rule goes

.htaccess, which most hosts use

The file sits in the same folder as wp-config.php. It starts with a dot, so your file manager may be hiding it. There is usually a “show hidden files” option.

Paste your rule above the line that says # BEGIN WordPress. This is the single most common reason a correct rule appears to do nothing. WordPress’s own block ends with an [L] flag that stops processing, so anything after it never runs.

RewriteEngine On
RewriteRule ^old-page/?$ /new-page/ [R=301,L]

# BEGIN WordPress
# ... leave everything below this alone

Download a copy of the file before you change it. A broken .htaccess takes the whole site down with a 500 error, and the fix is to put the old file back.

Nginx

Nginx ignores .htaccess entirely. The rule goes in the server block and needs a config reload to take effect. On managed hosting you usually cannot edit this yourself, so either ask support or use the plugin option instead.

The Redirection plugin

Safest choice if you would rather not touch server files. Install Redirection, go to Tools then Redirection, and paste the source and target it gives you above. A mistake here breaks one redirect. A mistake in .htaccess breaks the site.

The trade off is speed. A plugin redirect loads WordPress first, then redirects. A server rule redirects before WordPress starts. For a handful of redirects nobody will notice. For thousands, do it at server level.

Mistakes that cost people a weekend

Redirect chains

Page A points to B, B points to C. Every hop adds delay and loses a little ranking strength. When you move a page that was already redirected, update the original rule to point at the final destination instead of adding another.

Redirect loops

The browser says “too many redirects” and nothing loads. Usually the rule sends a page to itself, often because the pattern matches the destination as well as the source. The other common cause is forcing HTTPS behind Cloudflare: the server still sees plain HTTP, so it redirects forever. The rule this tool generates checks X-Forwarded-Proto as well, which is what stops that.

Sending everything to the homepage

Tempting when you delete a lot of pages, and it wastes all of them. Google treats a redirect to an unrelated page as a soft 404 and passes nothing. Send each page somewhere genuinely relevant, or let it return a real 404. A clean 404 is better than a misleading redirect.

Forgetting the pattern is a regular expression

In a rewrite rule a dot means “any character”, so /pricing.html also matches /pricingXhtml. This tool escapes those characters for you. If you write rules by hand, remember to escape them.

Common questions

How long should I keep a redirect?

At least a year. Google usually transfers ranking within a few weeks, but old links and bookmarks keep sending people for far longer. Redirects cost nothing to leave in place.

Do redirects hurt SEO?

A single well aimed 301 is fine and is exactly what search engines want when a page moves. What hurts is chains, loops, and redirecting to irrelevant pages.

My rule is not working

Check these in order. Is it above # BEGIN WordPress? Are you testing in a browser that already cached an earlier 301, and have you tried a private window? Is a caching plugin or Cloudflare serving the old page? And does the pattern have a leading slash, which it should not have in .htaccess?

Can I redirect with query strings?

Not with the rules here. A query string like ?id=42 is not part of the path a rewrite rule matches, so it needs a RewriteCond on %{QUERY_STRING} as well. That is niche enough that it is worth writing by hand rather than guessing from a generator.