I am a developer working on several projects. Each of these is separate, and I'll likely have more in the future. Each project has it's own domain and may be hosted in various places. When I'm developing I like to have all the files on my local computer. So I have several sub-directories, each one containing the files needed for that project.
If I want to view the files in a browser I do something like
That is fine, except now my designer is using some include files like this
So no matter where he wants that file included (meaning on a page that may be 2 sub-directories lower than the root of the web) it will grab includedfile.html from the root directory of the web.
This works fine for each projects live domain that is hosted on a production server.
may have the include of /includedfile.html.
includedfile.html is located at www.project1.com/includedfile.html
That all works fine, but I now need to get that same functionality locally.
If I type in localhost/somethings/direc
ile.html I don't get the included file because apache has /var/www/html as the document root for all on the server.
What I am trying to do is set up virtual hosting for each project on my local machine. I would like to be able to use something like http://project1.localhost
and get that directory of files. So then I can type http://project1.localhost/somethings/directory/testfile.html
and the includedfile.html will be there properly because project1.localhost has the document root set at /var/www/html/project1.
Then the different project files in each sub-directory won't interfere with each other.
Is there a way to accomplish this locally and what do I alter and set up?