The virtual host context is a part of the static configuration file between <VirtualHost>
and </VirtualHost>
tags.
RewriteRule
's in virtual host context match against the part of an url after the protocol, hostname and port, and before the query string.
When the following rule is used for the url http://example.com/foo?id=1
, the regex in the first argument of RewriteRule
is matched against /foo
.
<VirtualHost 1.2.3.4:80>
ServerName example.com
RewriteEngine on
RewriteRule ^/foo$ /bar [L]
</VirtualHost>