SitePoint Sponsor

User Tag List

Results 1 to 17 of 17
  1. #1
    SitePoint Zealot
    Join Date
    Sep 2006
    Location
    Minnesota
    Posts
    134
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Absolute URL vs. Relative URL

    I've heard mixed information as to which is better to use for your site's hyperlinks.

    - For Development, relative URLs are a lot easier to use for dev environments.
    - For SEO, I've heard it's a lot better to use absolute paths.

    What are the truths (pros & cons) for using Absolute or Relative paths? Which is better?

  2. #2
    Is Still Alive silver trophybronze trophy RetroNetro's Avatar
    Join Date
    Jul 2003
    Location
    Texas
    Posts
    6,883
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    I do not know if my opinion is the truth, but I would think that both are primarily the same, but if one IS better than the other the full path would win out.

  3. #3
    runat="server" Golgotha's Avatar
    Join Date
    Nov 2001
    Location
    Colorado
    Posts
    2,085
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I always use absolute.

  4. #4
    SitePoint Zealot
    Join Date
    Sep 2006
    Location
    Minnesota
    Posts
    134
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    So, is it preference more than anything?

  5. #5
    SitePoint Zealot skanxalot's Avatar
    Join Date
    Mar 2003
    Location
    Dallas, TX
    Posts
    167
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I've heard differing opinions on this as well. From a search engine's perspective, I'm not sure why preference would be given to one over the other. Seems arbitrary to me.

  6. #6
    SitePoint Zealot
    Join Date
    Sep 2006
    Location
    Minnesota
    Posts
    134
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    While I'm not sure if this is true or not, I've also heard that having relative paths is a lot more efficient and quicker for in-site browsing.

  7. #7
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,181
    Mentioned
    191 Post(s)
    Tagged
    2 Thread(s)

    paths

    As I understand, relative paths can save some server resources when the server needs to access other files. Kind of allows the server to take a "short cut" to the file. But as far as users or bots are concerned, they need the full path to get to the page and either use the full absolute path when present, or create it by putting together the "base" URL (the page they're on) and the relative path.

  8. #8
    Galactic Overlord gold trophysilver trophybronze trophy
    HAWK's Avatar
    Join Date
    Aug 2003
    Location
    New Zealand
    Posts
    12,545
    Mentioned
    956 Post(s)
    Tagged
    14 Thread(s)
    From the SEO FAQ's

    Should I use relative links or absolute links?

    Absolute links. It is recommended by Google as it is possible for crawlers to miss some relative links.

  9. #9
    Matthew's Daddy Mike Empuria's Avatar
    Join Date
    Oct 2004
    Location
    Box, Wiltshire
    Posts
    514
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Think about your backlinks.

    If you want people to link to "www.yoursite.com" then your internal links to your homepage should be "www.yoursite.com." By using internally the same links that you want others to use you are telling SEs what the important links are. So, if you want people to link to "www.yoursite.com/forums/" then your internal link to your forum pages should be "www.yoursite.com/forums/"

    It's unlikely that anyone will link to "www.yoursite.com/privacy.html" so you can keep that relative.

  10. #10
    SitePoint Wizard bronze trophy hooperman's Avatar
    Join Date
    Jan 2006
    Location
    Manchester, UK
    Posts
    4,301
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Should I use relative links or absolute links?

    Absolute links. It is recommended by Google as it is possible for crawlers to miss some relative links.
    Anyone know where Google said this? It doesn't sound right to me. I know that Google can crawl and index relative links; if it can do that with some, then why not all?

  11. #11
    Galactic Overlord gold trophysilver trophybronze trophy
    HAWK's Avatar
    Join Date
    Aug 2003
    Location
    New Zealand
    Posts
    12,545
    Mentioned
    956 Post(s)
    Tagged
    14 Thread(s)
    Dunno. I have never seen it written anywhere else. I always use absolutes though. Can't hurt...

  12. #12
    He's No Good To Me Dead silver trophybronze trophy stymiee's Avatar
    Join Date
    Feb 2003
    Location
    Slave I
    Posts
    23,423
    Mentioned
    2 Post(s)
    Tagged
    1 Thread(s)
    It was from their webmaster guidelines before they updated it. It's not there any more. But it wasn't meant to indicate that relative links were bad. Google just said there was potential for error in using them and recommended full URLs as a result. There are other benefits, non-seo, to using full URLs but that's another topic.

  13. #13
    Serial Publisher silver trophy aspen's Avatar
    Join Date
    Aug 1999
    Location
    East Lansing, MI USA
    Posts
    12,937
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    http://www.markcarey.com/googleguy-s...messed-up.html

    http://www.markcarey.com/googleguy-s...or-google.html


    I have a lot of SEO bookmarks.....

    I believe this has also been said once or twice on Matt Cutt's blog.
    Chris Beasley - I publish content and ecommerce sites.
    Featured Article: Free Comprehensive SEO Guide
    My Guide to Building a Successful Website
    My Blog|My Webmaster Forums

  14. #14
    SitePoint Wizard bronze trophy hooperman's Avatar
    Join Date
    Jan 2006
    Location
    Manchester, UK
    Posts
    4,301
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the links!

    I'm trying to imagine a situation where a relative link might be hard to 'decipher', but I can't. I suppose it's water under the bridge if the warning's been removed.

  15. #15
    Serial Publisher silver trophy aspen's Avatar
    Join Date
    Aug 1999
    Location
    East Lansing, MI USA
    Posts
    12,937
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It is just one more variable. If there is a bug in the crawler and they attribute the wrong domain to your relative link then that link might not work. It could be a one in a billion chance, but if that one in a billion site is yours, you won't feel lucky.

    So even if the risk is low, with an absolute link you know there is no risk.
    Chris Beasley - I publish content and ecommerce sites.
    Featured Article: Free Comprehensive SEO Guide
    My Guide to Building a Successful Website
    My Blog|My Webmaster Forums

  16. #16
    I am Learning... Vick!'s Avatar
    Join Date
    Oct 2005
    Posts
    632
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Nice topic. I will stop using relative links from now.

  17. #17
    SitePoint Addict mickmel's Avatar
    Join Date
    Feb 2001
    Location
    Marietta, GA
    Posts
    274
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I always use absolute because I typically use a lot of mod_rewrite on my sites. This can easily make you appear to be in a directory, and that will break your relative link.

    For example, if I had a page that was at mysite.com/product/hoops and another one that was mysite.com/product/balls/mitts ("balls/mitts" being one category), browsers would think we were now in the "balls" directory instead of just the "product" directory and the relative links would all be broken.

    Bottom line: with absolute links, you don't have to think about it.
    MickMel.com - My portfolio, etc.
    @mickmel - Twitter
    Google Earth Hacks - Fun stuff for Google Earth.


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
  •