I have seen lot of developers working with wamp server will come up with the relative path problem
The best solution for the relative path problem is Creating virtual host.
Here are the procedures to setup virtual host in your wamp server
There are two files involved:
– hosts (this file is in the c:\windows\system32\drivers\etc\ folder)
– httpd.conf (this is in your Apache install’s ‘conf’ folder – mine is c:\wamp\Apache2\conf\httpd.conf)
When you open the “hosts” file, you will see this line at the bottom:
All you do is make another entry underneath it for your client site:
127.0.0.1 myclient.local (Use whatever extension you want (ex: .local))
…and save the file. You can make as many as you want for as many clients as you want. Just keep adding more lines like that last one. Basically what happens is when you type ‘myclient.local’ into a browser now, windows will check the ‘hosts’ file before checking the internet.
Now you need to open the httpd.conf file and add a couple things.
…then add some crap underneath it to reroute ports and whatnot. If you’re in the same boat as me, this doesn’t work because ‘#NameVirtualHost *:80′ is not in my httpd.conf file.
Here’s what I did instead. Underneath ‘DocumentRoot “c:/wamp/www”‘ add this chunk of code:
…then underneath that add this chunk:
…obviously you’ll need to modify the code a bit to match the server name with the one from your ‘hosts’ file and the DocumentRoot with your client’s file path.
But that’s basically it. The problem you have now is that when you try and access your files from another computer on your local network,
the sites somehow revert back to not liking absolute paths.