Redirect one specific old URL path to a new destination (e.g. an old blog post to its new location).
.htaccess file, typically in your site's root directory. Always back up your existing .htaccess before making changes.
301 Redirects • HTTPS Enforce • IP Block • Apache mod_rewrite
Redirect one specific old URL path to a new destination (e.g. an old blog post to its new location).
.htaccess file, typically in your site's root directory. Always back up your existing .htaccess before making changes.
This tool builds common Apache .htaccess rules visually, using mod_rewrite for redirects and mod_authz_core for IP restrictions. A few correctness details worth knowing: when redirecting a domain, the dots in the domain name are escaped (example.com becomes example\.com in the underlying regex) — an unescaped dot in a regular expression matches any character, which is a subtle but real security-relevant bug if left unescaped. The non-www redirect uses %1, a backreference to the captured group from the preceding RewriteCond, not $1, which instead refers to a capture from RewriteRule's own pattern — mixing these up is a common source of broken redirects. The Force HTTPS rule always includes a %{HTTPS} off condition; omitting it is one of the most common .htaccess mistakes, since it causes already-secure requests to be redirected again and again in an infinite loop. All rules are generated locally in your browser.