Search and jump to any tool. Type to filter; use arrow keys to move and Enter to select.
Generates Apache mod_rewrite rules for redirects: exact paths, wildcard patterns with captured segments, and raw regular expressions.
Generates Apache mod_rewrite rules for redirects: exact paths, wildcard patterns with captured segments, and raw regular expressions. Site-wide switches add HTTPS enforcement, www or non-www canonicalization and trailing-slash handling. Everything is wrapped in an IfModule block so the file fails safely on servers without mod_rewrite.
Exact path: /old-page to /new-page, 301 Wildcard: /blog/* to /articles/$1, 301
RewriteRule ^old-page$ /new-page [R=301,L] RewriteRule ^blog/(.*)$ /articles/$1 [R=301,L]
Good to know. A request that needs both the HTTPS rule and the host rule will be redirected twice, first to HTTPS and then to the canonical host, so test with a header inspector after deploying. The file only works on Apache with AllowOverride enabled; nginx and IIS ignore .htaccess.
Used for the www redirect. Scheme and www are stripped automatically.
Rule 1
Matches one path exactly. /old-page → /new-page
Pattern: ^old-page$
Rule 2
Use * to capture a segment, then $1, $2… in the destination. /blog/* → /articles/$1
Pattern: ^blog/(.*)$