SEO · Free tool
.htaccess Redirect Generator
Build a ready-to-paste .htaccess redirect block. Choose simple Redirect directives or regex-capable RewriteRule patterns.
Add to .htaccess at site root
<IfModule mod_rewrite.c> RewriteEngine On Redirect 301 /old-page /new-page Redirect 301 /blog/old-slug /blog/new-slug </IfModule>
Redirect vs RewriteRule
Use the simple Redirect directive for one-to-one URL mappings. Use RewriteRule when you need regex capture groups (e.g., redirecting an entire /old-blog/(slug) pattern to /blog/(slug)). The toggle above swaps between the two.
After deploying
.htaccess changes take effect immediately — no Apache restart needed. Always test the rules with the redirect chain visualiser to confirm a single hop. If you're on nginx instead of Apache, use the nginx redirect generator. The full cheatsheet of pitfalls is in .htaccess redirect cheatsheet.
Quick rules
- 301 for permanent moves (transfers link equity).
- 302 only for genuinely temporary redirects.
- 307 when you must preserve the HTTP method (POST stays POST).
- Group related rules; comment generously.
FAQ
Does .htaccess slow my site down?
Slightly. Apache reads .htaccess on every request unless AllowOverride is None and rules are moved into the main vhost config. For high-traffic sites, prefer vhost-level redirects; for shared hosting, .htaccess is fine.
How do I redirect with a regex pattern?
Use RewriteRule with regex flags. For example RewriteRule ^old-blog/(.*)$ /blog/$1 [R=301,L]. The L flag stops further rewriting; R=301 forces a 301 response.
Will the redirect work without restarting Apache?
Yes. .htaccess changes take effect immediately for the next request. No restart needed - that is the main reason .htaccess exists.