.htaccess Redirect Generator
Generate Apache .htaccess redirect rules for WordPress and other websites. Create common 301 and 302 redirects without manually writing redirect syntax.
Runs locally in your browserGenerate .htaccess Redirects
Always back up your existing .htaccess file before editing it. Apache configuration and hosting environments can vary, so test redirects after adding the rule.
How to create an .htaccess redirect
Choose a redirect mode, enter the old path and destination, then generate the rule. For WordPress sites, custom redirects are often placed before the main WordPress rewrite block when your host allows manual .htaccess edits.
301 vs 302 redirects
A 301 redirect means the move is intended to be permanent. A 302 redirect is temporary. Use 301 for retired URLs and 302 when you expect the original URL to come back.
Where is the WordPress .htaccess file?
On Apache-based WordPress hosting, the .htaccess file is usually in the WordPress root directory. Some hosts hide dotfiles in file managers, and some managed hosts do not allow direct edits.
Common .htaccess redirect examples
RewriteRule ^old-page/?$ /new-page/ [R=301,L]
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
Frequently asked questions
What is a 301 redirect?
It is a permanent redirect that tells browsers and search engines a URL has moved.
What is a 302 redirect?
It is a temporary redirect for moves, tests or campaigns where the original URL may return.
Does this work with WordPress?
Yes on many Apache-based WordPress installs, but hosting rules can vary.
Where should I add the generated rule?
Usually before the main WordPress rewrite block, unless your host documents a different approach.
Can a bad .htaccess rule break my site?
Yes. Keep a backup and be ready to restore the previous file.
Should redirects go before WordPress rules?
Often yes, because WordPress rewrite rules can catch requests before later custom rules run.
