A path or a full URL; the domain is stripped from both.
2
Pick the status
301 for a permanent move, 302 or 307 for a temporary one, 410 for content that is gone.
3
Copy the rules
Apache 2.4 syntax for a .htaccess file, with a note on where to put it.
301, 302, 307 or 410
A 301 tells browsers and search engines that the move is permanent, and they will cache it — sometimes for months. A 302 is temporary and is not cached the same way. A 307 is also temporary but preserves the request method, which matters for a POST; a 302 historically allowed a browser to switch it to GET.
A 410 says the resource is gone and will not come back. It removes a page from search results faster than a 404 in some cases, and it is the honest answer when content is deleted rather than moved. Do not use a 301 to a homepage for deleted pages; search engines treat that as a soft 404.
Order matters in .htaccess
Rules are applied top to bottom and the [L] flag stops processing after a match. A redirect placed below a front-controller rule such as WordPress's index.php rewrite will never run. Put redirects at the top, above the framework rules, and keep the RewriteEngine On line once.
The pattern is matched against the path without the leading slash, and regular-expression characters in a path must be escaped. This generator escapes dots and other special characters for you, which is the difference between a rule that matches /old-page/ and one that also matches /oldXpage/.
Testing the rule
A browser caches a 301 aggressively, so test with curl -I first and look at the status line and the Location header. If the rule is wrong, the browser may keep sending you to the old destination even after you fix it; use a private window or clear the cache.
The HTTPS and www block is a separate, common job: force the scheme and pick one hostname. Replace the example domain in the output with your own before uploading. Nginx does not read .htaccess at all; it needs a server block, so these rules are only for Apache.
Frequently asked questions
Does this work on nginx?No. nginx does not read .htaccess; it needs a server configuration block.Are query strings preserved?A plain RewriteRule drops the query string. Add QSA to the flags if you need it kept.How do I redirect a whole folder?Tick the folder option and the rule captures everything after the old path, appending it to the new one.Why does the browser still go to the old page?A 301 is cached. Test with curl and clear the cache or use a private window.Where do the rules go?In the .htaccess file at the site root, above any front-controller rules.Is anything uploaded?No. The rules are generated in this tab from the values you type.