Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Apr 2011
    Posts
    59
    Thanks
    8
    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.

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,980
    Thanks
    4
    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •