referencing sub-dirs of htdocs

Discussion in 'Apache' started by pi_1, Jul 7, 2007.

  1. #1
    I have a problem referencing sub-dirs of htdocs in my html code.

    This works fine: src="images/pic.gif"

    But this fails: src="/images/pic.gif"

    Unfortunately I have a lot of existing code which uses the second example's format (with the preceding slash). I need to configure my WAMP to work with this format.

    I am installing WAMP to match the php + mysql versions on an existing web server. So I cannot change versions of php nor mysql. I am using:
    Apache 1.3.37
    PHP 4.46
    MySQL 4.1.22


    Can I configure Apache to work with this format: src="/images/pic.gif" ?
    Or would another version of Apache work?

    Thanks
    Phil
     
    pi_1, Jul 7, 2007 IP
  2. powerspike

    powerspike Peon

    Messages:
    312
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #2

    ok, "images/pic.gif" is a relitive url, whereas "/images/pic.gif" is an absolutey url.

    ok what this means.

    if your at www.website.com/
    "images/pic.gif" = "www.website.com/images/pic.gif"
    "/images/pic.guf = "www.website.com/images/pic.gif"
    if your at www.website.com/aboutus/
    "images/pic.gif" = "www.website.com/aboutus/images/pic.gif"
    "/images/pic.gif" = "www.website.com/images/pic.gif"

    If this is the case (which seems to be the simple answer)
    you need to create /images and copy/move all your images into that directory and /images/ will work instead of images/
     
    powerspike, Jul 7, 2007 IP