Im using Windows 7, and there I installed apache server in c:\wamp\apache\, PHP is located in c:\wamp\php\, and loaded as module.
So lets say I’m building test project and I only have index.php in that project.
Folder of that project will be located in c:\wamp\apache\htdocs\test\index.php and I can access that through my browser: localhost\test
This all works nice, but I have problem when I include images, css and js files.
lets say I want to include css style, i must use this:
<link rel="stylesheet" href="/test/images/image.jpg" />
and I would like to use this for a href:
<link rel="stylesheet" href="/images/image.jpg" />
So that / is root, and from there I can search for files inside my project folder.
What should I do? Should I create virtual server for every project, or there is a way that every folder in my htdocs folder acts as it would on live server, where / would translate to document root?
How should I setup Apache server so that every folder in my htdocs folder acts as server for itself?
When I use XAMPP it works like that.
Thanks!
If you want to avoid these kind of headaches, you should have a virtualhost for every project.
You can just put in your httpd.conf (with wamp: left click on wamp > apache > httpd.conf)
Don’t forget to restard wamp, and include in your hostfile (C:\Windows\System32\drivers\etc\hosts):