mod-rewrite Tutorial

mod_rewrite is a module for Apache. This module is used for internal rewrites (external requests that should load a different resource) and external redirects (external requests that should make the client request a different url).

mod_rewrite provides a finer control over internal rewrites than mod_alias, as the latter can only map requests to filenames. mod_rewrite provides some means of access control, but this is usually better done with mod_authz_core and mod_authz_host. mod_rewrite provides some integration with mod_proxy, but for performance reasons this integration should not be used and instead ProxyPass and ProxyPassMatch of the latter module should be used.

mod_rewrite can be set up in a way that allows for directives to be placed in the dynamic (.htaccess) configuration files. For performance reasons, one should always use the static (httpd.conf) configuration file whenever possible.