Apache - treat url path as virtual host

Ruslan picture Ruslan · Aug 1, 2011 · Viewed 26.3k times · Source

The problem is that I have only one domain name on which 3 different products need to be run (2 of them PHP based, 1 python). So what I need to do is to treat path in url as different virtual host; ie:

www.domain.com/first_url/
www.domain.com/second_url/
www.domain.com/third_url/

Where first to third will act as separate virtual hosts.

Any clue how to do this?

Answer

x3c7 picture x3c7 · Aug 23, 2012

It's been a while since this question was asked but since I was looking for a solution for a similar kind of problem, I'll add the solution.

This can be achieved by using Alias or AliasMatch directive. More details can be found here:

http://httpd.apache.org/docs/2.2/mod/mod_alias.html

Alias /first_url/ /var/www/first_url_resources