Link and File Path Problems

Discussion in 'HTML & Website Design' started by minnseoelite, Jan 18, 2007.

  1. #1
    Ok I am creating a site that has the main pages located in the root directory and other pages within different sub directories such as /codes/layouts/page.php

    I am using PHP includes for the navigation menu, header, and footer to make the site easier to update but am having a problem with the files located in the sub directories showing the wrong link paths for the links in the navigation menu. I have tried a few things with no luck. Basically on each page I have this include for my nav menu column which works great for pages located in the root directory.

    <? include("menu.php"); ?>

    But when I visit a sub directory page on my site like www.mysite.com/codes/layouts/blue-layout.php there is an error message where the menu should be.

    So after seeing this I changed the includes code to

    <? include("../../menu.php"); ?>

    on all sub directory pages I then go and check my site again GREAT the menu is there no but WAIT when I hover over a link in the nav menu it does not point to www.mysite.com/index.php it instead takes me to www.mysite.com/codes/layouts/index.php which of course generates a 404 page not found error.

    I am sure alot of you know how to fix this and I am sure its a simple fix so could someone please let me know what to do.
     
    minnseoelite, Jan 18, 2007 IP
  2. Pietercornelis

    Pietercornelis Guest

    Messages:
    631
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Pietercornelis, Jan 18, 2007 IP
  3. minnseoelite

    minnseoelite Peon

    Messages:
    845
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    0
    #3
    well thanks yea about 4am only a half our after posting this i was staring at the code and the solution just hit me lol.......maybe i should do my coding when sleep deprived more often lol
     
    minnseoelite, Jan 18, 2007 IP