localhost and relative paths - apache

Discussion in 'Web Design and Development' started by vegaspass00, Feb 16, 2009.

  1. vegaspass00 macrumors newbie

    Feb 16, 2009
    I have Apache running and i'm tring to get my website running on my localhost before I push it to my live server but i'm unable to see some of the javascript and css files with relative url paths.

    for example:
    if i go to my index page
    when i try and use the relative path for the css file: /includes/css/main.css

    it thinks my css file is at this path
    but it is actually supposed to be at this path

    does anyone know what settings i need to change in order for the relative paths to work on my localhost.

  2. jestershinra macrumors regular

    Sep 4, 2004
    Removing the / before includes should do it. Initial slash characters refer to the root path--you want the includes path that is a subdirectory of the current directory, not the root.
  3. angelwatt Moderator emeritus


    Aug 16, 2005
    That's not a relative path, that's an absolute path. Whenever your link starts with a / it's an absolute path. A relative path would start with a file name, folder name (without preceding slash), or ../

    As jestershinra said, just remove the / at the front and it should be fine.

Share This Page