Casual Articles
#1 in Business Subscribe Email Print

You are here: Home > Internet and Businesses Online > Web Design > Understand Site-Relative versus Document-Relative Web Links

Tags

  • adsense
  • linkssite
  • rootlet
  • forward slash
  • servers notion

  • Links

  • Fitness For Golf Is The Key To Rejuvenating Your Golf Game
  • Learn What Identity Theft Criminals Do With the Personal Information They Have Stolen
  • Call to Action: The Most Vital Piece of Any Business Web Site
  • Casual Articles - Understand Site-Relative versus Document-Relative Web Links

    How Bloggers Are Making Thousands of Dollars From the Google Adsense Affiliate Program
    There is no doubt that the Google Adsense program for publishers and site owners is one of the most successful affiliate programs anywhere. There is increasing evidence that many bloggers have managed to find the right formula to make thousands of dollars every month from little more than a handful of blogs with carefully created and compiled content.Unfortunately this has also led some unscrupulous bloggers to try and ste
    elative links are not relative to the documents they are contained in -- they are relative to the entire website.

    Document-Relative Links

    Any relative link that is NOT a site-relative link MUST be a document-relative link. Document-relative links are links that are relative to the document that contains them. Here are some examples of document-relative links:

    comedy.html -- refers to the file comedy
    Real Estate SEO (Search Engine Optimization): Making a Smart Choice
    As a real estate professional, you qualify as a prime prospect for most companies offering real estate SEO (search engine optimization) services.You want more sales and more listings and they want you to believe that they can give that to you.If you haven't already gotten calls, emails or letters from a few real estate SEO companies telling you that they can get your real estate website into the
    The documentation in the Dreamweaver HTML Layout Editor software package talks about two distinct types of relative links in HTML, but the concepts are applicable to any web page; with or without Dreamweaver. The two types of relative links are:

    1. Site-Relative. The address of the link is relative to the overall site.
    2. Document-Relative The address of the link is relative to the address of the document the link appears in.

    It is important to understand that if you are testing web pages and sites on a computer without a web server, site-relative links probably will not work. With that said, here are detailed explanations of site relative links versus document relative links.

    Site Relative-Links

    In a site-relative link the address always begins with a forward slash -- "/". The forward slash indicates that the address is relative to the web server's notion of the site root.

    Let us suppose that your site is located at the web location:

          http://www.TotallyNonExistentSite.com

    Furthermore, let us now suppose that you want to refer to a document located at:

          http://www.TotallyNonExistentSite.com/RedDirectory/FatDirectory/Jokes.html

    Then the site-relative address of that document would be:

          /RedDirectory/FatDirectory/Jokes.html

    and, a link to that document would look like this:

          <a href="/RedDirectory/FatDirectory/Jokes.html">Relative Address of Joke File</a>

    It is important to understand that this link will work from any other document in the website, NO MATTER WHERE IT IS LOCATED! The reason is simple -- site relative links are not relative to the documents they are contained in -- they are relative to the entire website.

    Document-Relative Links

    Any relative link that is NOT a site-relative link MUST be a document-relative link. Document-relative links are links that are relative to the document that contains them. Here are some examples of document-relative links:

    comedy.html -- refers to the file comedy.
    Getting Started with Business Incubators
    You have a head spinning with business ideas but you encounter difficulties in financing? Or you have recently started your great potential business but are not yet turning profit? A fundamental aspect for your business, financing is usually the most frequent obstacle in starting a business. You have the option of resorting to a business incubator on condition that your business idea seems viable and promising. Now if you wonder
    he link appears in.

    It is important to understand that if you are testing web pages and sites on a computer without a web server, site-relative links probably will not work. With that said, here are detailed explanations of site relative links versus document relative links.

    Site Relative-Links

    In a site-relative link the address always begins with a forward slash -- "/". The forward slash indicates that the address is relative to the web server's notion of the site root.

    Let us suppose that your site is located at the web location:

          http://www.TotallyNonExistentSite.com

    Furthermore, let us now suppose that you want to refer to a document located at:

          http://www.TotallyNonExistentSite.com/RedDirectory/FatDirectory/Jokes.html

    Then the site-relative address of that document would be:

          /RedDirectory/FatDirectory/Jokes.html

    and, a link to that document would look like this:

          <a href="/RedDirectory/FatDirectory/Jokes.html">Relative Address of Joke File</a>

    It is important to understand that this link will work from any other document in the website, NO MATTER WHERE IT IS LOCATED! The reason is simple -- site relative links are not relative to the documents they are contained in -- they are relative to the entire website.

    Document-Relative Links

    Any relative link that is NOT a site-relative link MUST be a document-relative link. Document-relative links are links that are relative to the document that contains them. Here are some examples of document-relative links:

    comedy.html -- refers to the file comedy
    That Will Never Work!
    Because it's purpose is to create a customer, the business has two - and only- two functions, marketing and innovation. Marketing and innovation produce results, all the rest are costs. - Peter DruckerIf innovation is a primary function of a business, what happens to your ability to innovate when new initiatives g
    tes that the address is relative to the web server's notion of the site root.

    Let us suppose that your site is located at the web location:

          http://www.TotallyNonExistentSite.com

    Furthermore, let us now suppose that you want to refer to a document located at:

          http://www.TotallyNonExistentSite.com/RedDirectory/FatDirectory/Jokes.html

    Then the site-relative address of that document would be:

          /RedDirectory/FatDirectory/Jokes.html

    and, a link to that document would look like this:

          <a href="/RedDirectory/FatDirectory/Jokes.html">Relative Address of Joke File</a>

    It is important to understand that this link will work from any other document in the website, NO MATTER WHERE IT IS LOCATED! The reason is simple -- site relative links are not relative to the documents they are contained in -- they are relative to the entire website.

    Document-Relative Links

    Any relative link that is NOT a site-relative link MUST be a document-relative link. Document-relative links are links that are relative to the document that contains them. Here are some examples of document-relative links:

    comedy.html -- refers to the file comedy
    Are you Interested in Increasing your Google PageRank?
    You should be. If you have never heard of Google PageRank and you have established a website, it is high time you learned about Google PageRank and what it means to you and the success of your website. Having an excellent Google PageRank can either make or break a website in terms of overall success. Let's take a look at what Google PageRank is and why it is so important to every website owner.First, a word about t
    address of that document would be:

          /RedDirectory/FatDirectory/Jokes.html

    and, a link to that document would look like this:

          <a href="/RedDirectory/FatDirectory/Jokes.html">Relative Address of Joke File</a>

    It is important to understand that this link will work from any other document in the website, NO MATTER WHERE IT IS LOCATED! The reason is simple -- site relative links are not relative to the documents they are contained in -- they are relative to the entire website.

    Document-Relative Links

    Any relative link that is NOT a site-relative link MUST be a document-relative link. Document-relative links are links that are relative to the document that contains them. Here are some examples of document-relative links:

    comedy.html -- refers to the file comedy
    How To Hire Board Of Directors For Your Business: Tips
    Hiring a board of directors for your business is not an easy task. You have to select the most responsible people who think clearly and can come to a decision quickly in times of crisis. The success of your business rests on them largely, and they should be able to take the best possible decisions without any personal bias creeping into it. Many businesses do not give adequate attention to the board of directors at the hiring st
    elative links are not relative to the documents they are contained in -- they are relative to the entire website.

    Document-Relative Links

    Any relative link that is NOT a site-relative link MUST be a document-relative link. Document-relative links are links that are relative to the document that contains them. Here are some examples of document-relative links:

    comedy.html -- refers to the file comedy.html in the same folder.

    humor/sickjokes.htm -- refers to the file sickjokes.html, which is located in the humor folder, relative to the directory of the document it is referenced in.

    ../MotherInLawJokes.html -- refers to the file MotherInLawJokes in the folder above the directory of the document it is referenced in.

    Links to the above three documents would look like this:

          <a href="comedy.html">Address of file in same director</a>
          <a href="humor/sickjokes.html">Address of file in lower level director</a>
          <a href="../MotherInLawJokes.html">Address of file in directory one level up</a>
    Conclusion

    When you move a document that contains root-relative links the links will continue to work. On the other hand, the root-relative links which refer to that document may break. In general, for working on small sites, document-relative links are preferred, and they have the additional advantage that they can be tested on a computer that does not host a web server.

    copyright 2006 Sam Mela

    HTTP = HTML link (for blogs, profiles,phorums):
    <a href="http://www.casualarticles.com/article/84819/casualarticles-Understand-SiteRelative-versus-DocumentRelative-Web-Links.html">Understand Site-Relative versus Document-Relative Web Links</a>

    BB link (for phorums):
    [url=http://www.casualarticles.com/article/84819/casualarticles-Understand-SiteRelative-versus-DocumentRelative-Web-Links.html]Understand Site-Relative versus Document-Relative Web Links[/url]

    Related Articles:

    A Look at Deck Fasteners

    Am I Getting Scammed

    Writing Effective White Papers

    Bookmark it: del.icio.us digg.com reddit.com netvouz.com google.com yahoo.com technorati.com furl.net bloglines.com socialdust.com ma.gnolia.com newsvine.com slashdot.org simpy.com shadows.com blinklist.com