I m working on a web project and there a requirement that it works good on top domain, and on a domain+directory paths like this:
www.myDomain.com
www.myDomain.com/somedir/myproject/
The project deals with well with include files,
But i fail to setup my VHosts to test the second case www.myDomain.com/somedir/myproject/
My current setup is as simple as possible:
hosts
127.0.0.1 www.myDomain.com
httpd-vhosts.conf
NameVirtualHost *:80
<Directory C:/Projects>
Order Deny,Allow
Allow from all
</Directory>
<VirtualHost *:80>
DocumentRoot C:\wamp\www
ServerName localhost
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "C:\Projects\MyProject\public_html"
ServerName "www.myDomain.com"
</VirtualHost>
#@ToDo make this work ...
#<VirtualHost *:80>
# DocumentRoot "C:\Projects\MyProject\public_html"
# ServerName "www.myDomain.com/somedir/myproject/"
#</VirtualHost>
.htaccess
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule !\.(js|ico|gif|jpg|png|css)$ index.php [NC,L]
Can i do this just with Virtual host ? What is the best practice to achieve this setup on local machine?