Problem with links in local website

Discussion in 'HTML & Website Design' started by MarkHoward, Aug 27, 2009.

  1. #1
    I have three folders (at the same level) in my website, running locally (xampp):
    NZMotorhome/
    NZMotorhomeForum/
    NZMotorhomeChat/

    In NZMotorhomeChat/index.php I have a link, thus
    This links correctly and opens the NZMotorhomeForum/index.php file.

    In NZMotorhome/MainPage.html I have an identical link,
    When this link is clicked a listing of the NZMotorhomeForum directory is displayed instead of opening the the NZMotorhomeForum/index.php file.

    Can anyone suggest why this might be happening - or what I can do to try to figure out what is happening?

    Thanks.
     
    MarkHoward, Aug 27, 2009 IP
  2. cool_fp

    cool_fp Peon

    Messages:
    13
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    it will show the whole directory if you place this
    because this link is asking for the directory not the index.php file and if you want assign a link to index.php then you have to mention proper link to that so here is the corrected code you mention above
    so always try to assign link to exact same that will always solve your problem also if you want to run that page on local host them write code such like this
     
    cool_fp, Aug 28, 2009 IP
  3. MarkHoward

    MarkHoward Peon

    Messages:
    6
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks for the input..
    A couple of points:

    1. If the problem is not being able to find the default file, why does it manage to find and open the file (index.php) when linked from NZMotorhomeChat but not from NZMotorhome?
    3. If I add "/index.php" to the end of the link (as suggested), I get is a display of text in block format based on the code in index.php. Nothing is rendered.
    I'm foxed :(

    Added later....
    OK. If I add the absolute localhost address in the front (rather than the relative ../ address) it works. Also I don't need to add the specific "index.php".
    I can't understand 2 things:
    Why will a relative address not work in a localhost environment?
    Why does the relative link work fine from NZMotorhomeChat (but not from NZMotorhome)?
     
    Last edited: Aug 28, 2009
    MarkHoward, Aug 28, 2009 IP