Apache multiple DocumentRoot

JP19 picture JP19 · Dec 27, 2010 · Viewed 26.3k times · Source

How can I have the following setup in apache?

http://server/ABC/* should be served by /var/www/ABC/*

http://server/PQR/* should be served by /var/www/PQR/*

Every other request should be served by /var/www/Others/index.php (a single file).

Thanks,

JP

Answer

Taber picture Taber · Dec 27, 2010

Use Alias:

Alias /ABC/ /var/www/ABC/
Alias /PQR/ /var/www/PQR/

Leave the document root pointing to /var/www/Others/index.php. It could do the trick. :)