Last Updated: 14 Oct 2023
Apache: Rewrite vs Redirect
Apache has two ways to serve one page when you were asked for another:
Rewrite* rules via mod_rewrite (e.g.
Redirect* rules via mod_alias (e.g.
What are the differences?
mod_rewriteis generally considered the more powerful, and more complex, solution. It offers the
RewriteConddirective, which lets you only run a Rewrite rule if certain conditions are met.
mod_aliasis simpler, and lets you match on a simple string or on a regular expression, but does not allow you to put conditions in (other than those defined by the regexp)