Apache HTTP Server

Apache Modules

Each apache module (mod_proxy) has a some directives (ProxyPass)

Virtual Host

Means having more than one server on one machine, as differentiated by their apparent hostname. We can have IP-based or name-based vh. IP-based virtual hosts use the IP address of the connection to determine the correct virtual host to serve. Therefore you need to have a separate IP address for each host. With name-based virtual hosting, which is easier, the server relies on the client to report the hostname as part of the HTTP headers. Using this technique, many different hosts can share the same IP address.


RewriteEngine On
RewriteRule ^/index.html$ /1.html

'last|L' (last rule)
Stop the rewriting process here and don't apply any more rewrite rules.

'redirect|R [=code]' (force redirect)
Prefix Substitution with http://thishost[:thisport]/ (which makes the new URL a URI) to force a external redirection.

Remember that this flag on its own will only prepend http://thishost[:thisport]/ to the URL, and rewriting will continue. Usually, you will want to stop rewriting at this point, and redirect immediately. To stop rewriting, you should add the 'L' flag.


This directive allows remote servers to be mapped into the space of the local server. The path is the name of a local virtual path and url is a partial URL for the remote server and cannot include a query string.

ProxyPass /mirror/foo/ http://backend.example.com/ 
will cause a local request for http://example.com/mirror/foo/bar 
to be internally converted into a proxy request to http://backend.example.com/bar
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License