I want to host two different websites on the same domain, example:
<VirtualHost *:80>
DocumentRoot /var/www/www1/
ServerName my.domain.com
...
</VirtualHost>
<VirtualHost *:80>
DocumentRoot /var/www/www2/
ServerName my.domain.com/www2
...
</VirtualHost>
This config is ofcourse wrong, but it depicts what I want to do. When someone go to my.domain.com he will be served by web application from /var/www/www1. When someone go to my.domain.com/www2 he will be served by web application from /var/www/www2. Is this possible in Apache?
You are not really configuring named virtual hosts or ip based virtual hosts, so forget about second
VirtualHost
entry and set an alias in first:This isn't true FQDN, but FQDN with path. You cannot point this as domain. Use aliases.
Senseless question on the level of "I want to eat a vegetarian cw steak".
Basically, if you want to use two domains, then USE TWO DOMAINS. Your example uses the same domain, so it does not match the titel and text.
Showing two different contents under the same domain DOESN OT WORK. Shwoing different contexts in different folders under a domain works, but iti s not the same as hosting the same website under two domains.