All tools / WordPress

HTACCESS Redirect Generator

Generate a permanent Apache redirect from one path to another URL.

How to create a redirect rule

  1. Enter the old path, starting with a slash, for example /old-page/.
  2. Enter the full new URL, for example https://example.com/new-page/.
  3. Press Run tool and copy the rule.

The output looks like this:

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

R=301 makes the redirect permanent. L stops Apache from processing more rules for that request. NE stops Apache from encoding special characters in the destination a second time. The tool also escapes characters such as dots in the old path, so they match literally.

Where to put the rule in WordPress

Your .htaccess file sits in the root folder of your WordPress install, the same folder as wp-config.php. You can edit it through your host's file manager, over SFTP, or with an SEO plugin that offers a file editor.

  1. Download a backup copy first. One typo in this file can take the whole site down with a 500 error.
  2. Paste the rule above the line # BEGIN WordPress. WordPress rewrites everything between its BEGIN and END markers, so rules placed there can disappear.
  3. If the file already contains RewriteEngine On above your new rule, you do not need to repeat it.
  4. Save, then test the old URL with the redirect checker. You should see a single 301 followed by a 200.

Things that trip people up

Trailing slashes. /old-page and /old-page/ are different paths to Apache. Enter the exact form people and search engines use. Most WordPress sites use the trailing slash.

Query strings. RewriteRule does not see anything after the question mark. This generator only accepts plain paths. Redirecting ?p=123 style URLs needs a RewriteCond rule.

Nginx servers. Nginx ignores .htaccess files completely. If your host runs Nginx, add the redirect in the server configuration, ask your host, or use a redirect plugin. LiteSpeed servers read .htaccess just like Apache.

Redirect chains. If page A already redirects to B, and you now redirect B to C, update the A rule to point straight to C. Each extra hop slows the visit and wastes crawl budget.

Browser caching. Browsers remember 301 redirects. When testing changes, use a private window or the redirect checker, not your normal browser tab.

When to use a 301 redirect

If there is no close replacement, let the old URL return a 404 or 410. Redirecting everything to the home page is treated as a soft 404 by Google and frustrates visitors.

.htaccess or a plugin?

A handful of permanent redirects are fine in .htaccess. They are fast because they run before WordPress loads. If you manage hundreds of redirects or need logs of 404 errors, a plugin like Redirection is easier to maintain. The WordPress migration plugins guide covers moving sites where redirects matter most.

Frequently asked questions

Should I use 301 or 302?

Use 301 for permanent moves. Use 302 only for short-term redirects, such as a temporary sale page.

Can I redirect a whole folder?

Not with this tool. Folder redirects need a pattern with a capture group, and a mistake there can redirect far more than you intended.

Related tools

WordPress

WordPress Slug Generator

Turn a post title into a clean URL slug.

Open tool →
WordPress

Password Generator

Generate a random password using browser cryptography.

Open tool →
Text

Word Counter

Count words, characters, sentences and reading time.

Open tool →