Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
Thread: Problem with localhost/xampp
01-17-2012, 10:07 PM #1
- Join Date
- Apr 2011
- Thanked 0 Times in 0 Posts
Problem with localhost/xampp
Just a quick question for you guys.
I develop on xampp and I develop multiple sites in sub-folders. My problem is that it's not letting me use each sub-folder as its own site.
So say I'm coding on site a. And in it I want image and I call it like I would on a webserver with <img src="images/a.gif"> and then on site b I call it like <img src="image/b.gif">. Each sub-folder has it's own images folder.
The problem is, instead of image a calling localhost/a/images/a.gif like it would on a web-server is calls localhost/images/a.gif. Is there a way to fix this other then calling it using localhost/a/images/a.gif? Because I would hate to have to do that and then rewrite all the links when it came time.
01-19-2012, 02:55 PM #2
- Join Date
- Sep 2002
- Saskatoon, Saskatchewan
- Thanked 2,659 Times in 2,628 Posts
Use a relative path for the images instead. The behaviour is otherwise normal since these are subdirectories and not site roots, so when it wants to look from the root it will go directly from localhost and not localhost/x. You can also lock the site root in using html's base tag which can be used temporarily while developing (which is IMO the fastest way to write a simple test up).
So IMO you should either use a base to temporarily change the location of the base url, or you should use relative paths instead.