How to Use Server Absolute or Root Relative Hyperlinks

By Virginia DeBolt

Rate: (1 Ratings)

In basic HTML, one of the first things you learn is that there are relative and absolute links that you can use in your web pages. Absolute links are usually described as a link to an external site that includes the full URL. But there is a type of absolute link used within a website called server absolute or root relative that is also useful. Here are some tips for working with it.

Instructions

Difficulty: Moderate

Things You’ll Need:

  • A basic text or HTML editor
  • A site hosted on an Apache server

Step1
Server absolute links work on Apache servers if the server is configured for it.
Step2
A Root Relative Link A server absolute link uses a forward slash at the beginning (with no dots) to force the path to start from the site's root level on the server. This type of link works anywhere in your site without all those relative path dots and slashes that point the way from one web page to another within your site. In this example image, the absolute path to the file beginning from the site root is into the "about folder" to find the contact.html page.
Step3
The path in this type of link is relative to the site root, rather than to the location of the page where it's placed in the site structure. This creates some opportunities to streamline the process of creating links that are repeated again and again on many different pages in a website. Links in a navbar are a good example.
Step4
Many web designers work with time-saving tools like Dreamweaver library items and templates. These can be set up to use root relative links, so that the same library item or template region will work everywhere and won't require maintenance to keep the links working right.
Step5
Server side includes can also benefit from root relative links. I explained that concept in my article: "How to Add Server Side Includes to a Website Using PHP" (see Resources below). Although the article discusses PHP includes, you can also use server side includes based on site absolute links that work with HTML.

Post a Comment

POST A COMMENT

Request a New How-To Article

Looking for more How To information? Chances are there’s an eHow member who knows how to do what you’re looking to do. Submit an article request now!

eHow Article: How to Use Server Absolute or Root Relative Hyperlinks

eHow Expert: Virginia DeBolt

Virginia DeBolt

Expert: Internet

Profession: http://www.vdebolt.com

Location: USA

Related Ads

Internet

Veesites
Meet Virginia DeBolt eHow’s Internet Expert.