SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Hybrid View

  1. #1
    SitePoint Member nosta's Avatar
    Join Date
    Mar 2001
    Location
    Brussels, Belgium
    Posts
    14
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hello,

    I have a qimple question :
    Does it matters to put absolute links inside you website ?
    exemple : instead of ../test.php -> http://host.com/test.php

    Will it change something, like speed would be the most obvious or not ?

    Have a nice day ! Thanks for your help !
    The love of art.

  2. #2
    Anyone seen my cypher? OneChance's Avatar
    Join Date
    Apr 2001
    Location
    Seattle
    Posts
    281
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Either way is fine, but if you ever change domain names, then you'll have to change all of those links. Relative links are better, especially relative to the document root (links starting with /). Speed wouldn't be a noticeable factor.

  3. #3
    One website at a time mmj's Avatar
    Join Date
    Feb 2001
    Location
    Melbourne Australia
    Posts
    6,282
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    It doesn't really matter, when you think of the way your browser works.

    When your browser follows a relative link, it works out the absolute link based on the directory the current page is in.

    So the request to the server is the same either way.

    However, make sure you are consistent with your links. If you have a page called http://www.myhost.com/thispage/ , then don't refer to it later as "thispage" (without the trailing slash) or "thispage/index.htm". Even though they may find the same page, the request to the server is different and thus caching is not working.

    You could, however, refer to it just as "/thispage/" or "../../../thispage/" etc, as the browser will translate that to "http://www.myhost.com/thispage/"

    If you see what I mean.
    [mmj] My magic jigsaw
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    The Bit Depth Blog Twitter Contact me
    Neon Javascript Framework Jokes Android stuff

  4. #4
    SitePoint Member nosta's Avatar
    Join Date
    Mar 2001
    Location
    Brussels, Belgium
    Posts
    14
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for your posts !
    I asked because I work with "php-includes" so relative links would have been more difficult to manage.
    C ya and thanks again !
    The love of art.

  5. #5
    SitePoint Enthusiast excessus's Avatar
    Join Date
    Apr 2001
    Location
    Spain
    Posts
    29
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I made my links always relative, because it will make your life easy if you like to move folders around later on. This is a rule we always trust!
    Lead Designer at www.mcomdesign.com
    Webmaster at www.marbella.com
    Read my comic strip! www.danstrip.com


Bookmarks

Posting Permissions

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