Skip to main content

Virtual Host on a sub directory [Resolved]

This question already has an answer here:

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:

The project deals with well with include files,

But i fail to setup my VHosts to test the second case

My current setup is as simple as possible:



NameVirtualHost *:80

  Order Deny,Allow
  Allow from all

  DocumentRoot C:\wamp\www
  ServerName localhost

    DocumentRoot "C:\Projects\MyProject\public_html"
    ServerName  ""

#@ToDo make this work ...
#    DocumentRoot "C:\Projects\MyProject\public_html"
#    ServerName  ""


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?

Question Credit: d.raev
Question Reference
Asked April 14, 2019
Posted Under: Network
1 Answers

Your Answer