e enjte, 27 shtator 2007

Powerful SEO tips for 2007

Of all the challenges that webmasters face, SEO is one of the most daunting. If you are unsure what it is, SEO stands for Search Engine Optimization, meaning how you as a webmaster can get Google, Yahoo, and MSN among others to rank your website in the top search results for the keywords you are targeting. When I personally approach SEO, I do not look at it as a single all encompassing thing. Instead, I break it down, into the 2 important categories that I can focus on.

In its simplest form, I like to divide SEO down into 2 more manageable areas. The first of two categories is On-site Optimization, and the second area, predictably is Off-site Optimization. Both are important, many webmasters do not grasp or utilize this. Some of them preach that on-site optimization is truly the only important form of SEO, many others will say that off-site optimization is what will get you top rankings in the search engines. But the real deal is that they are both important, and neither should be ignored. So what is the difference between the two.

In a nutshell, On-site optimization is the editing and coding of your actual website to increase optimization. Off-site optimization is the Link Popularity, Link Relevance, and anything else that is not a direct change to your own webpage. For a good example of just how powerful Off-site optimization is, Google the word failure. I am sure that George Bush is not optimizing for that term anywhere on the Whitehouse webpage. In my opinion, the key factors of SEO, in no particular order are:

1) Link Popularity and Link Relevance (Off-site) 2) Internal Linking Structure (On-site) 3) Content Relevance (On-site) 4) Crawl-ability / Code Optimization (On-site)

This might seem like an over simplification of SEO, which in some regards it is. However, the key factors that I just mentioned above are the basis and are easily broken down into much finer detail, such as the kind that you may find in an in-depth book or report. One thing to keep in mind with SEO in 2007 is that getting high rankings on the Search Engines is not going to happen overnight, sometimes not even for months, just because you have optimized your webpage. If this were 7 or 8 years ago, then keyword stuffing and meta-tags would work just fine. But that tactic will just not cut it in todays competitive search engine market. This is no reason to get discouraged however. Just make sure that you utilize a balanced attack of on-site and off-site optimization, through utilization of social-networking sites, link partnering, quality content, text link campaigns and more.

Jonathan Heusman has been involved in marketing online for the past 9 years. Find out the tricks, tools, and tips that he utilizes to gain the competitive edge in internet marketing at his website Major Marketing Tools

How to Improve The Efficiency of Your King Content

There are thousands of articles, books and forum posts which showed that content is king in search engine optimization (SEO). In this article, you can find some ways that can help you improve this king content for your web site.

* Content for people first, not for search engines - Some webmasters make a common mistake that they optimize everything for search engines but forget about web visitors. The goal of our website is not only to get high search rankings, but also to sell our service. So you should give your web visitors what they are really looking for. Make sure your content flows naturally and you're not just trying to stuff more keywords in the interest of search engines. If users don't find your content convincing they won't buy from you.

* Studying popular search terms - High search engine ranking is meaningless if your website only ranks high on terms nobody searches for. You need to ask your colleagues, vendors, competitors, clients, ... or use online tools (e.g.: wordtracker.com) to identify what keywords which potential customers would use to search your web site, then try to use them often, in titles, and throughout the body.

* Building article directory - How can you optimize the content if your web site only offers a simple service? It means there are just several pages in your whole website. So, to increase the content in quality you should write some articles, reviews which are related to your service. A site with more web pages means there are more chances of different terms that will become findable in search engines. You may consider adding free articles to your article directory. On the Internet today, one can find a lot of websites which provide articles free for republishing. Of course you must accept the policy of these web sites and authors before using these articles.

* Making a clear website organization - Build a site which is simple to navigate with a well linking structure. Every page should be accessible from at least one text link. It's better to be sparing with image links, Flash, JavaScript drop-down menus, or other codes that are not HTML based... because the search engine crawlers cannot recognize text contained in these kinds of display. In case using them is required, then make sure a text based menu or a sitemap is also included in the Web site. Last but not least, you should use meaningful words in your URLs, use as simple a web page layout and design as possible.

In conclusion, it is undeniable that content is king in the kingdom of search engines. The quality of your content is the main factor which decides the success in Internet marketing. So improving your content is very necessary.

8 proven methods to get one way links for your website

One way links are very important to get top 10 rankings on search engines. Now Google gives very low importance to reciprocal links as it can easily understand this has been done just to boost search engine rankings and nothing else.

A lot of time people ask me how can i get one way links for my website. In that case i suggest them the following methods to acquire natural one way links:

1 - Write articles- Write meaningful and informational articles on your website so that other people who find you article useful may link to you from their websites. This is one of the best and proven way to get natural one way links.

2 - Blogging - Partcipitae in blogs at other sites or create a blog on your website and post latest news on this blog and discuss it with other people and this again let other sites link to you. Very soon you will find the listing of your blog in lot of other blogs plus other informational sites will also not hestiate in linking you from their website.

3 - Directory Submission - Submit your site to free directories like Dmoz as listing in Dmoz is of great importance. Apart form dmoz there are various other small and big free directories where you can submit your site. This helps you in getting links from subject related to your website. Some other free directories are freeaddurl.org, monkey-directory.com,raptor-uk.com dreamz.mylinea.com, isins.com, ofidir.com.

4 - Forum Participation - Start taking active particiaption in forums that interst you most or on forums that relate to the subject of your website. You can leave a signature in your forum posts which may contain the url of your website with your main keywords in it.

5 - Submit your news and press release - Whenever anything big goes on your site than you can submit your news or press release to other sites that actively publish news of other sites. Like if you are a hosting company and you have launched a new hosting package which is better than others than submit the press release on hosting related sites which accept press releases. This not only provides you inbound link but also brings a lot of traffic to your website.

6 - Free Downloads - If you have developed any sofwtares or if you are able to create any software utlities, scripts, then you can provide them free on your website and this again makes other people to link to your website. You may also request people who downlaod from your site to link to your website so that you can provide them more related and improved stuff in future.

7- Extra Services - If you provide any service to people who own a website than you can ask them to link to your website and in return you can provide them some extra or value added service or extended support with your services. This can be of great interest to most of your clients as everbody loves a thing that comes as free .

8 - Add testimonials - Another added way to get links is to submit testimonials on websites from where you have purchased any services or products as webmasters may publish your testimonials on their website which may also contain the link of your site.

How to get free content for your newsletter, ezine or website

If you have experience in owning websites then you will know that content is king. If you do a simple search in a search engine and look at the results they prove this, the content rich pages will dominate the results. Ezines, or newsletters as they are sometimes known, also require a lot of content because after all content is what they are.

So now that we have learned that content is very important on the internet how do we go about getting content? There are three main strategies you can employ. Firstly you could write your own content. This is a great option if you are knowledgeable in your particular area, and believe you can write interesting content with proper grammar and good spelling. You may not have these qualities though and like many people you may simply not have the time or the motivation. The second main option you have to get content is to hire someone to write for you. This can be a great way of getting content for some people, but it can be very a very expensive method to choose. I come now to third option and to the option that I consider to be the best way of getting content for your newsletter, ezine or website and that is to harvest your content from what are termed article directories.

So what are article directories? Article directories are quite self explanatory really they are basically directories of articles. The reason they are so good for getting content though is that a vast majority of them have it in their own interest for you to use their content. The reason for this is that they allow you to use their content only on their terms, these being that you keep the link showing the source of the content. The writers or authors of the content too stand to gain because in writing their articles they include in the footer a link to their own website. So everyone is a winner in the equation.

So where can you find article directories? There are a number of strategies you can employ to find article directories. The first of which is to use a search engine to search for the term "article directories". Using this method you should find a plethora of websites which are suitable. Another, more easy method though, you could use to find these article directories is to use some of the web addresses of article directories I have listed for you below. At the time of writing all these websites allow you to use their content for your newsletter, ezine, or website providing of course that you follow their terms and conditions.

www.articlecentral.com
www.articlecity.com
www.ezinearticles.com
www.goarticles.com
www.ideamarketers.com
www.netterweb.com
www.turboarticles.com
www.valuablecontent.com
www.article-world.net
www.articlewiz.com
www.articles411.com
www.free-article-search.com

So now you have all the information you need to start filling your newsletters, ezines, or websites with all the free content you could ever need. Good luck!

How to prevent duplicate content with effective use of the robots.txt and robots tag.

Your primary weapon of choice against duplicate content can be found within “The Robot Exclusion Protocol” which has now been adopted by all the major search engines.

There are two ways to control how the search engine spiders index your site.
1. The Robot Exclusion File or “robots.txt” and
2. The Robots < Meta > Tag

The Robots Exclusion File (Robots.txt)

This is a simple text file that can be created in Notepad. Once created you must upload the file into the root directory of your website e.g. www.yourwebsite.com/robots.txt. Before a search engine spider indexes your website they look for this file which tells them exactly how to index your site’s content.

The use of the robots.txt file is most suited to static html sites or for excluding certain files in dynamic sites. If the majority of your site is dynamically created then consider using the Robots < Meta >Tag.

Creating your robots.txt file

Example 1 Scenario

If you wanted to make the .txt file applicable to all search engine spiders and make the entire site available for indexing. The robots.txt file would look like this:

User-agent: *
Disallow:

Explanation
The use of the asterisk with the “User-agent” means this robots.txt file applies to all search engine spiders. By leaving the “Disallow” blank all parts of the site are suitable for indexing.

Example 2 Scenario

If you wanted to make the .txt file applicable to all search engine spiders and to stop the spiders from indexing the faq, cgi-bin the images directories and a specific page called faqs.html contained within the root directory, the robots.txt file would look like this:

User-agent: *
Disallow: /faq/
Disallow: /cgi-bin/
Disallow: /images/
Disallow: /faqs.html

Explanation
The use of the asterisk with the “User-agent” means this robots.txt file applies to all search engine spiders. Preventing access to the directories is achieved by naming them, and the specific page is referenced directly. The named files & directories will now not be indexed by any search engine spiders.

Example 3 Scenario

If you wanted to make the .txt file applicable to the Google spider, googlebot and stop it from indexing the faq, cgi-bin, images directories and a specific html page called faqs.html contained within the root directory, the robots.txt file would look like this:

User-agent: googlebot
Disallow: /faq/
Disallow: /cgi-bin/
Disallow: /images/
Disallow: /faqs.html

Explanation
By naming the particular search spider in the “User-agent” you prevent it from indexing the content you specify. Preventing access to the directories is achieved by simply naming them, and the specific page is referenced directly. The named files & directories will not be indexed by Google.

That’s all there is to it!

As mentioned earlier the robots.txt file can be difficult to implement in the case of dynamic sites and in this case it’s probably necessary to use a combination of the robots.txt and the robots tag.

The Robots < Meta > Tag

This alternative way of telling the search engines what to do with site content appears in the section of a web page. A simple example would be as follows;



In this example we are telling all search engines not to index the page or to follow any of the links contained within the page.

In this second example I don’t want Google to cache the page, because the site contains time sensitive information. This can be achieved simply by adding the “noarchive” directive.



What could be simpler!

Although there are other ways of preventing duplicate content from appearing in the Search Engines this is the simplest to implement and all websites should operate either a robots.txt file and or a Robot tag combination.

Your RSS Feed Might Look Like Spam

RSS feeds seem to be the breakout technology for the year. With more users turning to them for driving traffic to their site, it’s no wonder that a trail of RSS feed spam is following in the wake. A careful editing of your RSS feed could make the difference between being classified as genuine content or RSS spam.

RSS search engines are just beginning to pick up steam. As more RSS feeds become searchable, the number of visitors will increase and spam is sure to follow. It is an unfortunate side effect of free communication. While RSS users can typically unsubscribe to feeds they deem as spam, browsing with keywords in an RSS search engine is where the problem arises.

RSS spam largely consists of three main types most often found in the RSS search engines. The first type is keyword stuffing.

Keyword stuffing involves filling each RSS feed article with high-value keywords for a specific topic. The articles are not intended for human visitors, but instead for search engine robots to direct traffic to a target web site. This RSS spam technique is nothing more than an adaptation of the typical keyword-stuffed web page, often banned by major search engines.

The second type involves RSS feed link farms. These RSS articles often contain very little content, if any, other than a simple keyword. Their main attraction is the feed title. Clicking the feed title takes the user to a blog containing tens or hundreds of other blogs and RSS feeds, each directing to more links within the farm. The goal of this type of RSS spam is to trick the user into clicking advertisements or directing them to a product web site.

The third type is the creation of fake RSS feeds. These appear as legitimate, but often duplicated, article content. Whether they provide value or not is certainly debatable. These feeds are usually created in mass, using automated scripts, and appear similar in nature to the link farms. By attracting the users to seemingly valuable content, they hope to gain advertisement clicks or product web site traffic.

Your RSS feed might happen to fall into one of these three categories. While you may currently be experiencing increased traffic from the RSS search engines, these directories are working on filtering out the RSS spam techniques. However, you can still take advantage of RSS feeds and their power by following an RSS-friendly guideline.

Refrain from using automated scripts to create online content used by your RSS feeds. Instead, write your own original thoughts, product descriptions, and reviews. It takes a little more time, but the search engines will value this content much more highly, your visitors will appreciate the unique content, and the subscription count to your RSS feed will grow. It is also important to keep your feed updated with changing content as opposed to using a static feed, which remains the same. Search engines value dynamic feeds and will likely rank you higher as a result.

There are tools and services available, which aid in keeping an RSS feed updated with your changing content. Such services include FeedFire for converting your web site content to a periodically updated RSS feed or software such as FeedForAll for creating and editing RSS feeds.

A successful RSS feed is very much the same as a successful web page. It may take a little more time to digitize your thoughts, but the end result is well worth the effort. By avoiding the tricks in RSS feed spam, you can help make the difference in quality of feeds and enjoyment in your readers.

About the Author: ksoft is a software company specializing in Internet products including RSS Submit http://www.dummysoftware.com/rsssubmit.html, software for submitting RSS feeds and pinging blogs to over 65 RSS directories.

Getting Google to Index - The Basics

Getting Google to Index – the basics

Frequently I come across those who encounter either a perceived delay or other problem in getting their site into Google’s index. Whilst occasionally some sites don’t show within the index it is more common place to find the site in question already within the index but for whatever reason that it wasn’t being looked for correctly.

Has Google found your site?
There is a very simple way to answer this question – enter your URL into Google’s search box.
(eg: www.yourdomain.whatever)

If your site does feature then it will show up a link to the main page, together with the message –
Google can show you the following information for this URL:

If your site fails to feature the following message will greet you –
Sorry, no information is available for the URL

If Google hasn’t found your site
There is no need for immediate panic! What you need to ensure is that you have a few links coming into your site – you don’t need hundreds, at least not to start with.

Probably the easiest way to achieve this is to enter yourself into some basic, perhaps local, directories. These need not be the paid for kind as what you are aiming for is to bring Googlebot/Google’s spider to your site.
(Take a look at SearchGuild’s directory forum for further inspiration.)
Another option would be to arrange a few reciprocal links with sites that are similar to your own – this is basically where you exchange links with each other.
Do not be under the misconception that you need these links to be from high PR sites/pages – more important is that the sites providing you with the links are themselves regularly crawled.

To keep track or see what Google has indexed from your site enter the following into the search box:
site:www.yourdomain.whatever
This will bring up the pages of your site that Google has indexed.

If Google doesn’t crawl beyond your homepage
There can be a few reasons for this. However you should at least give Google a little time to do this. The primary things to check if you feel that Google is definitely showing no interest with the rest of your site are:

Put in a site map – site maps list and link to the other pages within your site. Place a link to one from your home page as it should make for smoother indexing.

Title, description & keyword meta tags – it is best to vary at least the meta description tag on each page so as spiders do not confuse pages as being the same. It also assists with the site being found for different phrases within various search engines.

Robots.txt files – make sure you are not inadvertently blocking spiders out of the other pages with a ‘no-follow’. Unless you know what you are doing and have reason to use this type of file then you are better not doing so.

Navigation – check that your pages are user friendly with functioning internal links. You should have some text links from your homepage directed inwards as well as linking from your internal pages back to the homepage and ensure they all work.

Flash & Javascript – keep both to a minimum, especially on your homepage.

Generally Google is fairly swift at picking up on new sites so getting into the index should not prove a problem for most. However, it can take a while for a whole site to be indexed and unreasonable for you to expect whole inclusion virtually overnight! Another common misconception is if it is a case of your site not ranking where you expect it to then this is not the same as ‘not being indexed’.

Submit Your Article- Who, Where and What

Here are a few places where you can submit your articles for
maximum exposure.

1) Article Banks

2) Article Directories

3) Forums

4) Search Engines

5) Announcement Lists

6) Blog Owners

7) Newsletter Publishers

8) Webmasters

9) MSN Spaces

10) Your Blog

11) MSN Groups

12) Yahoo Groups

13) Google Groups

14) EBay About Me Page

15) Adlandpro

You can use these professional services to submit your articles:

1) http://WWW.Isnare.com

2) http://WWW.Thephantomwriters.com

3) http://WWW.Reprintarticles.com

4) http://WWW.Opportunityupdate.com

5) http://WWW.Submityourarticle.com

6) http://WWW.Ezinetrendz.com

Here are two software that you can use to automate your
submissions :

1) The Ezine Announcer available at http://WWW.Ezineannouncer.com

2) Newsletterpromote.com available at
http://WWW.Newsletterpromote.com

With such a list to choose from there should be no complaining
about where to publish your articles. And don’t forget to
optimize your title, headings, sub-headings, body text and links
to add that extra punch.

Meta Tags - What Are They & Which Search Engines Use Them?

Defining Meta Tags is much easier than explaining how they are used, and by which engines. The reason is very few engines clearly lay out what they do and do not look at, and how much emphasis they put on any one factor. So, we’ll start with the easy part

Meta Tags are lines of HTML code embedded into web pages that are used by search engines to store information about your site. These "tags" contain keywords, descriptions, copyright information, site titles and more. They are among the numerous things that the search engines look for, when trying to evaluate a web site.

Meta Tags are not "required" when you're creating web pages. Unfortunately, many web site operators who don’t use them are left wondering why the saying "If I build it they will come" didn’t apply to their site.

There’s also a few naysayers in the search engine optimization industry who claim that Meta Tags are useless. You can believe them if you like, but you would be wise not to. While not technically "required", Meta Tags are essential.

If you simply create a web site and register the URL with the search engines, their spiders will visit your site, and attempt to index it. Each search engine operates slightly differently, and each one weighs different elements of a web site according to their own proprietary algorithms. For example, Altavista places an emphasis on the description tag and Inktomi states on their web site that;
Inktomi "(...) indexes both the full text of the Web page you submit as well as the meta-tags within the site's HTML."
Other search engines like Exactseek are true meta tag search engines which clearly state their policy:
"Your site will not be added if it does not have Title and Meta Description tags."
They also use the keywords tag.

Of course, not all search engines work this way. Some place their emphasis on content. The search engines have over 100 individual factors they look at when reviewing a web site. Some of these factors deal with page structure. They check to see that all the 't's are crossed, and the 'i's dotted. They note sites that have omitted basic steps, like missing tags.

One reason so many engines de-emphasized the meta-keyword tag had to do with spam. There was a time when 'search engine promotion specialists' would cram keywords tags full of irrelevant information. The web site would be selling garbage cans, but the keywords tags were chock full of irrelevant terms like "mp3" or "Britney Spears". They figured that if enough people visited their site, some would buy.

So today, to avoid and penalize this kind of abuse, some search engines don’t specifically use the keywords tag as part of the scoring of a site, but they monitor the keywords to ensure they match the content in the site. The reasoning being that, if the tags are irrelevant, they must have an alternate purpose. Is it a spam site? When keywords tags are completely irrelevant to the content, some search engines, that don’t specifically use keywords tags, will penalize that web site.

Even for those engines that have downplayed the value of Meta Tags, there are situations where Meta Tags gain considerably in importance, e.g. sites with rich graphics, but poor textual content. Unfortunately, a picture is worth 1000 words to you and me, but zero to a search engine. If a site has poor textual content, the engines will be more dependent than ever on the Meta Tags to properly categorize it.

Even if you ensure you have completely relevant Meta Tags, some search engines will still ignore them. But better they ignore them, than they ignore your whole site because they suspect something is less than above board. Never hope that having Meta Tags will make the difference in all the search engines; nothing is a substitute for good content. But in cases where the engine depends on that content, it may be the only thing that does work for your site.

So How To Use The Meta Tags?

Meta tags should always be placed in the area of an HTML document. This starts just after the tag, and ends immediately before the tag. Here’s how the most basic set should look:

Search Engine Optimization Software - Metamend


Always make sure that your meta tags do not have any line breaks, otherwise the search engines will just see bad code and ignore them. You should also avoid use of capitals in your code (html5 standard) as well as repetition of terms within the keywords tag.

What Goes Into a Meta Tag?

For the Description tag: ; Many search engines will display this summary along with the title of your page in their search results. Keep this reasonably short, concise and to the point, but make sure that it’s an appropriate reflection of your site content.

For the keyword tag;

Keywords represent the key terms that someone might enter into a search engine. Choose only relevant keywords. If the terms are going to appear in your keywords tag, they must appear in the content of your site, or be a synonym to a term on your site. Most search engines compare your meta content with what is actually on your page, and if it doesn’t match, your web site can get penalized, and suffer in search results.

for the Robots tag ;Many web pages have this tag wrong. An example of the wrong usage is content="index, follow, all" - wrong because some spiders can't handle spaces between the words in the tag or the word "all". Most engines by default assume that you want a web page to be indexed and links followed, so using the wrong syntax can actually result in the spider coming to the wrong conclusion and penalizing, or worse, ignoring the page outright. If by chance you do not want your links followed, or the page not indexed, then you would substitute "noindex" and or "nofollow" into the tag.

With the Internet growing at a rate of over 8,000,000 new pages per day, and the search engines adding a fraction of that number, Meta Tags are a common standard which can reasonably ensure a measure of proper categorization for a web site. So, always ensure that you cover all the bases, and use completely relevant terms in properly structured Meta Tags. Using tags properly will pay dividends in the short and long term. After all, using them properly only helps the search engines, which means they will send you more qualified traffic - customers.

The 5 Most Common SEO Mistakes

I thought there would be sense in providing a consolidated list of things you most definitely DO NOT want to be doing if you want a high ranking in the search engines. There are 5 main things that literally hundreds of thousands of webmasters err on regularly. With a few little changes they could make a big difference in their rankings. Below are the 5 most common errors and their solutions in no particular order.

1. Keyword flooding

The Error:

Trying to optimize a home page for all possible keywords. Often you will see Title tags for example loaded with 12+ keywords, where a webmaster is attempting to squeeze in all his/her keywords on the home page. A classic example of a little know-how being a dangerous thing!

What generally happens is not one of the 12+ words ever reach a high ranking for the reason that individually they can never get the keyword density or repetitions needed in order to rank highly. This is especially the case for popular terms. I laugh when I see spammers hiding loads of keywords in long lists, knowing that rather than improving their ranking they just make it worse!

Less, can mean a lot more when it comes to SEO in this respect.

The Solution:

Focus your home page for a MAXIMUM of three of your top keywords. If you have a particularly competitive field then make that just one or two keywords.

Concentrate on just those keywords on your home page and of course in your title tags. Eg. The ABAKUS home page (root) concentrates on 3 keyword phrases where it does very well in German searches. ‘Internet Marketing’, ‘Webpromotion’, and ‘Suchmaschinenoptimierung’ (search engine optimization). A newbie at SEO would also have added ‘Suchmaschinen eintrag’, ‘Suchmaschinenranking’, ‘Suchmaschinen platzierung’ and possibly more keywords to the title tag, and would have tried to optimize the home page for all the terms rather than spreading them throughout the site as I have done.

Summary:

Focus on your top three keywords (hopefully researched properly)for your home page, keep them to a maximum of three, however if you are really in a niche market with little competition, it is ok to go for up to 4 or 5. Try and keep your title tag to less than 7 words and make sure your text copy uses the three terms at least 3 times each. Don’t forget EVERY page is a potential entry page from search engines so there is no need to cram everything in on your home page.

2. Header area duplication

The Error:

It is human nature to be a bit lazy when developing a website. One of the most common, yet devastating for search engine traffic, mistakes is when a webmaster uses ‘save as’ to work on a new content page but forgets to change the non-visible header area of a page in Dreamweaver or whatever.

I think we’ve all seen these sites. A whole site has something like ‘widgets-for-sale.com’ in the title on EVERY page. The meta tags are identical on every page. Only the visible content is different. Rarely however do separate pages have exactly the same theme or content. Every page can be optimized for different keywords whether major or minor and can of course be an entry point to your site from a search engine. It is such a waste and almost makes me cry when I see great sites using mydomain.com for a title on every page.

The Solution:

When developing a site, stick to a pattern. I will normally do the content first but I always make sure the last thing I do before moving on to a new content page is to make sure I have not only the content optimized, but the area as well. You will not find an identical title tag on my whole website, or meta description for that matter. Never forget that each page is an entry page and optimize each to the best of your ability.

Summary:

Never repeat titles or meta descriptions in a website. Treat each page as if it were the most important and optimize it thoroughly. Don’t be tempted to leave the head area without optimization.

3. Unnecessary Framesets

The Error:

It is now rare that I will see a framed website and believe that the use of frames in anyway enhances the site, or that it is a practical necessity for a webmaster. It isn’t so much that framed sites generally rank lower, it is that few webmasters know how to correctly optimize them. This might give you an idea of the scale of the problem. http://www.google.com/search?hl=en&lr=&ie=UTF-8&oe=UTF-8&q=%22browser+does+not+support+frames+%22+&btnG=Google+Search

The majority of those 697,000 websites require search engine optimization as to be honest, their current optimization stinks. Not many of those sites are going to rank in the top 10 of anywhere. Just to have in your noframe tag "...browser does not support frames" Is a great way to never get your website found on a search engine.

The Solution:

Treat the noframe tag content as if it was a text version of your home page and optimize it as you would a normal website. Very important also is to link to your framed pages from your noframe area. Also for your framed pages consider javascript that will call the frame set should it be found orphaned in a search engine. Normally framed pages without the frameset, mean no navigation and not displayed as was initially intended. The following code placed in all framed pages is one solution and works on the majority of browsers…



There are more complex / better solutions which really wouldn’t fit in the space I have here. Try http://www.netmechanic.com/news/vol5/javascript_no7.htm for a more complete solution.

Also be aware that you can achieve what a frameset does through the use of CSS layer positioning, iframes and other methods. Only use frames if you really, really have to.

Summary:

If you must use frames, make sure you optimize them properly. Use the noframe tag properly and thoroughly link to framed pages. On your framed pages use javascript to prevent them being called without the frameset.

4. Splash / Flash sites

The Error:

I often see poorly ranked sites that visually contain a lot of text… but the text itself is not of the font variety but graphic. Great eye candy, but forget a high ranking and search engine traffic if that is the only text on a page. I would say at least half my clients used to suffer from overdoing graphic text. The main webmaster culprits for this are (surprise, surprise) adult sites, and also those targeting young markets where it is believed lots of graphics and eye candy is what impresses and sells (handy shops, games console websites, games software sites etc.)

Of course the worst of all has to be the Flash websites that offer no pure html alternative and the source code looks like the example I give in my SEO for flash tutorial page… http://www.abakus-internet-marketing.de/en/seo-tutorial/flash.htm

The Solution:

Integrate normal text where you can. You can make text and text links look great with a bit of css formatting know-how. You do not need graphic text to make text look attractive nowadays. At least do not make your pages all graphic text. Leave something for the search engine spiders to find and index. This also applies to Flash sites. Rarely does everything have to be a flash object. You can quite often have text surrounding a Flash object without any negative effects.

Summary:

Web pages that contain no normal text, or very little text, simply will not rank highly unless there is a VERY strong link campaign running. Mix graphics and objects with text. It is really this simple, No text = No ranking.

5. Keywords not researched

The Error:

Unfortunately too many webmasters do not really bother using any of several keyword research tools. There are about 4 or 5 of them. Most, like the overture keyword research tool, are free. Many webmasters don’t think they need to use them as they know what their site is about and don’t need to research the top keywords. This is a big mistake. Another big mistake is either optimizing for too niche or too obscure a search term, or going the other way and going for a very broad term with millions of competing pages on a new site with a only a handful of incoming links. Both are common errors and can result in all on page optimisation and off-page optimisation criteria, through requesting links with the wrong link text for example, to be a complete waste of time. You either get too little traffic as you optimized for terms that are rarely searched for, or you go for the terms with millions of competing pages but you simply do not have the experience or Pagerank to be able to compete.

The solution:

The balance is normally achieved through two or three word phrases in competitive areas and yet don’t have millions of competing pages. These are found best by cross referencing the several keyword research databases to be found on the ABAKUS online tools page http://www.abakus-internet-marketing.de/en/online-tools.htm and through a fair bit of lateral thinking.

Summary:

Don’t guess your best keywords, know them through taking the time to use the free tools out there.

Finally one for the road...

When Things Start Getting complicated

If you have a large dynamic online shop, have a large website which uses a content management system, a website that uses session ids for guests, or you are not that hot with html/css, then the contents of any online tutorial or what is on the web, as far as SEO goes, is unlikely to be enough to help you. In short you need professional help. My SEO tutorial is fine for static html pages, and albeit a little short on some of the more propriety methods every real SEO has and would never reveal, it can and regularly does get high rankings for those that follow it closely. However, when you are having to get into mod_rewrites, php path arguments to flatten urls and other technical measures to optimize a website there is plenty of room to screw things up. There are also identical content implications, optimal internal linkage planning and all kinds of other advanced concepts that someone new or even experienced in SEO webmasters should outsource. Of course you may say I’m going to say that anyway as I offer professional services, but you haven’t had to be the one that has had to sort out a mess which one client made trying to optimize their own .asp pages. The whole online shop went down for 3 days whilst professional .asp programmers came in to sort out the mess. This is a true story and happened because a beginner wanted to dynamically create the meta tags for each page himself for the search engines as he knew a little .asp programming. I kid you not.

The Solution:

Hire me :-)

Well, at least don’t try to do it yourself if you really are not sure what you are doing and the domain is of high value to you. You may also risk going over spam thresholds. For the price of less than your average small banner campaign (ABAKUS anyway) you could get it done by a professional.

Summary:

If a domain is not your standard static html page, is dynamic, uses session ids, cms etc. save yourself some possible heartache and get a professional in. At least go for a telephone consultation before you wade into the code.

Alan Webb is CEO of ABAKUS Internet Marketing, a professional search engine marketing company.

ROBOTS.TXT Primer

There is often confusion as to the role and usage of the robots.txt file. I thought it would be a good idea to dispel some myths and highlight what robots.txt files are all about.

Firstly, a robots.txt file is NOT to let search engine robots and other crawlers know which pages they are allowed to spider (enter), it is primarily to tell them what pages (and directories) they can NOT spider.

The majority of websites do not have a robots.txt, and do not suffer from not having one. The robots.txt file does not influence ranking in any way. Its goal is to disallow certain spiders from visiting and taking back with them pages you do not wish for it to do so.

Below are a few reasons why one would use the robots.txt file.

1. Not all robots which visit your website have good intentions! There are many, many robots out there whose sole purpose is to scan your website and extract your email address for spamming purposes! A list of the "evil" ones later.

2. You may not be finished building your website (under construction) or sections may be date/ sensitive. I for example excluded all robots from any page of my website whilst I was designing it. I did not want a half complete un-optimized page with an incomplete link structure to be indexed, as if found, it would reflect badly on myself and ABAKUS. I only let the robots in when the site was ready. This is not only useful for new websites being built but also for old ones getting re-launched.

3. You may well have a membership area that you do not wish to be visible in googles cache. Not letting the robot in is one way to stop this.

4. There are certain things you may wish to keep private. If you have a look at the abakus robots.txt file (http://www.abakus-internet-marketing.de/robots.txt) You will notice I use it to stop indexation of unnecessary forum files/profiles for privacy reasons. Some webmasters also block robots from their cgi-bin or image directories.

So let's analyse a very simple robots.txt syntax.

User-agent: EmailCollector
Disallow: /

If you were to copy and paste the above into notepad, save the file as robots.txt and then upload it to the root directory of your server (where you will find your home page)what you have done, is told a nasty email collector to keep out of your website. Which is good news as it may mean less spam!

I do not have the space here for a fully fledged robots.txt tutorial, however there is a good one at

http://www.robotstxt.org/wc/exclusion-admin.html

Or simply use the robotsbeispiel.txt I have uploaded for you. Simply copy and paste it into notepad, save it as robots.txt and upload it to your server root directory.

http://www.abakus-internet-marketing.de/robotsbeispiel.txt

Alan Webb is CEO of ABAKUS Internet Marketing a professional search engine marketing service company.

Why a search engine crawler is not at all like Lynx

We're often told, in the SEO industry, that we should imagine crawlers as a very simple browser like Lynx. Quite why that is, I don't know, I can only assume that it helps lazy search engine software developers. But it has become a general trend to confuse the two. The crawler shares just one basic, superficial, similarity to Lynx; it processes web pages in a very simple way. The difference stops there. I therefore believe it worthwhile to take some time to examine the differences and understand just where we could go wrong if we think of search engine crawlers as Lynx style browsers.

Let’s start by examining what the two pieces of software do:

Lynx: retrieves a web page specified by the user and reformats it for display on a screen. Included in that formatting is various extra bits of information such as what to do if a user performs a particular action (for example the title element in href tags).

Search Engine Crawler: retrieves a web page specified by a software program (often known as url control) and saves it. It extracts additional urls from it. Later this information is fed through the indexer to generate the actual search index.

These are very different tasks. Whilst Lynx has to actually understand the elements of the page, the search engine crawler does not. Because the crawler is not re-formatting for human viewing there is greater tolerance for error and it can do it’s job using simple pattern matching. Let’s take the extracting urls as an example. Lynx has to actually display the anchor, the crawler does not. So whilst lynx would have to understand ever element of the following url:



the crawler merely needs to looking for the pattern that represents an anchor (
” or ). Then extract the href section. This has two important implications:

1. Whilst Lynx must understand that things could be written in a different order in a different way, the simple pattern match of crawlers doesn’t matter.

2. Following on from 1, because it is a simple pattern match there is greater tolerance for errors. Consider this bad code:



It shouldn’t validate and so the browser has to choose how to deal with it. The crawler is just pattern matching, it still matches the rules I described earlier so it’s just fine.

Incidentally this is also why crawlers could, if their programmers choose to, easily find links in Javascript or unlinked citations. There’s a fundamental difference between interpreting Javascript and being able to find urls in Javascript. Thinking about this in human terms, if you give somebody who doesn't know Javascript a bit of code to look at with a url in it and ask them to tell you what the url is the chances are they’ll see it.

When we get to indexing this retrieved page (which just means creating the database for people to search), it’s actually nothing like Lynx either. With indexing we want to break things down to as little as possible. So the page is turned in to a list of positions of each word that occurs in the page and any special attributes. By special attributes I mean things like bold or font or color that’s different from the rest of the page. This really means that we have a very limited subset of html with very few tags, and because it is not actually displaying them the search engine has no need to understand what they mean but merely that they delimit a section of text.

I can only presume then, that those who support the view that Lynx shows pages like a crawler would see them do so because they believe that the more simplistic view represents something that must be closer to crawler. This again does not hold water. Sure it shows you a page without images, javascript, flash and so on. But that's a very superficial way of looking at things. Take the images, what about the filename? That's used in ranking but it doesn't show in Lynx. All you get without navigating through it's horrible menus is the alt text, well I can hover my mouse in IE as well as the rest of them. Javascript? Well I've already mentioned that search engines could read Javascript if they wanted to. It's there, it gets read and it gets processed but just not run. Flash? Doesn't AlltheWeb index flash? It sure does. Is this going to be a growing trend? You bet it is. So hang on, which of those simplifications is actually giving you a true or a better view when you're using Lynx? My answer is none of them.

Many of the people I've spoken to in an effort to try to understand the Lynx myth have pointed me to the "Google Information for Webmasters", which states:

--"Use a text browser such as Lynx to examine your site, because most search engine spiders see your site much as Lynx would. If fancy features such as Javascript, cookies, session ID's, frames, DHTML, or Flash keep you from seeing all of your site in a text browser, then search engine spiders may have trouble crawling your site. --"

We've dispensed with many of these elements already, showing why they don't hold water. Let's pick a couple more:

Cookies. Does Google's crawler support cookies? Nope. Does Lynx? It sure does, so why would we want to test our sites with it to check that the cookies are okay for Google?

Session ID's. Does Google's crawler support session ids? Nope. Does Lynx? It sure does, so why would we want to test our sites with it to check that the session ids are okay for Google?

The answer of course is in a little word that many of the people I spoke to forgot to read: "may". This essentially means the whole paragraph could be true, false, or partially true and partially false. The only true for Google there is "Flash", and that's unlikely to be a true too long in to the future. And frankly, if you don't know when you're using flash on your pages you've got problems

In reality, the average person using Lynx to check in the light of current advice given by many SEOs and Google themselves is likely to end up making mistakes and not finding them. I don't argue that there isn't a time when there is a benefit, I merely argue that a regular old browser and hovering the mouse or right clicking is more often than not less confusing, easier and with a lesser learning curve. To imply that Lynx is anything like a crawler is telling newbie Niel that because his site doesn't render or work in Lynx it won't get crawled. That's just plain wrong. It will always get crawled and the vast majority of the time it will get indexed.

I know that now I've written this there will be those that choose to disbelieve me because of established belief, or because of the perception that the established belief is doing something beneficial for them (i.e. that Lynx helps them). I know this because I've spoken to a few people and that has been the general reaction. My one and only answer to that is that I've programmed crawlers, I know the differences and that doing so shifts your conceptual understanding of them further away from the truth and not closer to it. Maybe you believe you can see something in it that you could not elsewhere, but in all likelihood you are doing yourself more damage than your perceived gain. The benefits you perceive you gain could well be precisely because you believe that Lynx views things like a crawler, i.e. the logic is circular in nature. Take another look at Lynx, ask yourself "if this is not a representation of what a crawler sees, then what do I gain from this viewpoint?". In either case I ask you to look at things afresh and not with the eyes of what has been said in the past or the proveable bad "may"s of one particular search engine, to make your own reasoned decision and, hopefully, to stop another myth.

PageRank Leakage

If you've read PageRank Uncovered or PageRank Explained, you'll probably recognise the effect that I'm going to talk about in this article. It's an effect that I didn't put the name to, but one that I want to cover in more detail here.

Why? Because it has become the focus of much attention and confusion lately. Some say it doesn't exist, some say it's a myth. So it's time to explain - can PageRank leak? And if it can, how important is that?

The Case against

The case against PageRank leaking goes that a page has a certain PageRank. That PageRank determines in part what the pages it links to get as their PageRank. But in doing that, the page itself doesn't actually lose any of it's PageRanks. To put it another way, if Page A has a certain PR, then regardless of how many pages it links to the PR of Page A isn't altered because it links.

The Explanation

The argument against is flawless with one exception, it ignores the fact that something is likely to link to Page A, that we're talking about a site so the PageRank likely to cycle back to Page A is probably not insignificant. Even though PageRank operates on a page and not a site basis, it is occassionally conceptually better to think in site terms. A site being a system of pages.

The unique characteristic of a site is that the pages tend to be tightly linked. This tight linking means that a page benefits itself by linking to pages on the site it's on. Conversely, it does not get the benefit that it would otherwise get if it linked off-site.

i.e. PageRank leakage is not a direct effect, but an indirect effect. Those that state that PageRank leakage does not exist are over-simplifying their conceptual understanding.

An analogy

Consider I have some magic money. $1000 of magic money. You can have that magic money, but there's some rules. The rules are that you have to give it all away. You have to give it to five members of your family and two strangers. There's another rule though, the people who receive the money each have to give 50 percent of what they receive to either you or one of the other six. The final rule is you can divide that $1000 dollars any way you please, giving however much you like (including nothing) to each person.

In terms of magic money, how wealthy is your family at the beginning? It has $1000. By human nature, you're going to want to do two things: the first is ensure you get the most money possible and the second is to try to ensure that that money which you can't get goes to your family. So when you first distribute the magic money you're not going to give any to the strangers. You're also going to distribute the most money to the family member who's most likely to give the 50% back to you whilst giving the others enough for them to not get jealous.

If, at any stage, someone gives magic money to the strangers then you haven't actually lost anything (I created this magic money out of thin air for you) but you also haven't made the most of the opportunity I have given you. It's that wasted opportunity that is the leak, causing you to have less than you could have had.

In comparison to web pages, the other pages on a site are like the family. They are more likely to give back and they are what you are more likely to want a page to give to if it can't have it for itself. Off-site pages are more likely to give to their site's pages (family) than back to you or yours.

Categorically

PageRank leakage does exist, but it's a logical and not direct effect. It really is another way of saying: "having lower PageRank than you could have had".

How Important is PageRank Leakage

The big question then becomes, should you not link out for fear of PageRank leakage? The answer of course depends on how much you need PageRank, how competitive an area you are in and whether you can target that PageRank to the right pages. To know that, it's probably best to read PageRank Uncovered. However, what we can say here is that even in the most competitive areas it is normally the case that some pages on a site need PageRank to rank and others do not need as much. It is also normally the case that people have not first tried to distribute the PageRank well before they worry about losing any.

The spending effect

When you link out from your site, there are benefits to doing so. Both in terms of user experience and in terms of ranking. The negative side is PageRank leakage. In this respect I would rather call it PageRank payment. This really breaks down to a very simple equation:

You should always link out to a site if it brings you more benefit than the PageRank you would lose.

That, like any purchasing decision is a judgement call that is up to you and doesn't necessarily need a value putting on PageRank for you to make it.

The other point to make here is that if I want to buy a coat, and I can buy it in one shop for $50 or another for $75. I'm going to buy the $50 version. Which simply means, do all in your power to minimize PageRank leakage but do not be afraid to spend PageRank when the benefits seem worthwhile.


What Is The Google Dance

Whenever I'm at trade shows, run seminars, or speak at symposiums I am asked the question "what is the Google dance?" I've heard a few different theories regarding "the Google Dance", but only one is really correct. It's the period when Google is rebuilding its rankings, and results fluctuate widely for a 3 to 5 day period.

How Often Does The Google Dance Happen?

The name "Google Dance" is often used to describe the period when a major index update of the Google search engine is being implemented. These major Google index updates occur on average every 36 days or 10 times per year, although the May 2003 Dance did start early, and may be more major than others. The Dance can easily be identified by significant changes in search results, and by an updating of Google's cache of all indexed pages. These changes can be evident from one minute to the next. But the update does not proceed as a switch from one index to another like the flip of a switch. In fact, it takes several days to finish the complete update of the index.

Because Google, like every other search engine, depends on their customers knowing that they deliver authoritative reliable results 24 hours of the day, seven days a week, updates pose a serious issue. They can't shut down for maintenance and they cannot afford to go offline for even one minute. Hence, we have the Dance. Every search engine goes through it, some more or less often than Google. However, it is only because of Google's reach that we pay attention to its rebuild more than any other engines

During this period, the index is constantly in flux, and search results can vary wildly, because it is also during the Dance that Google makes any algorithm adjustments live, and updates the PageRank and Back Links for each web site it has indexed.

Do Search Results Only Change During The Google Dance?

No, in fact, during any month there will be minor changes in rankings. This is because Google's bot or spider is always running and finding new material. It also happens because the bot may have detected that a web site no longer exists, and needs to be deleted from the index. During the Dance, the Googlebot will revisit every site, figure out how many sites link to it, and how many it links out to, and how valuable these links are.

Because Google is constantly crawling and updating selected pages, their search results will vary slightly over the course of the month. However, it is only during the Google Dance that these results can swing wildly. You also need to consider that Google has 8 data centers, sharing more than 10,000 servers. Somehow, the updates to the index that occur during the month, and outside of the Google Dance have to get transferred throughout. It's a constant process for Google, and every other search engine. These ongoing, incremental updates only affect parts of the index at any one time.

Checking the Google Dance

You may know that Google has 8 main www servers online, which are as follows:
* www-ex.google.com - (where you get when you type www.google.com)
* www-sj.google.com - (which can also be accessed at www2.google.com)
* www-va.google.com - (which can also be accessed at www3.google.com)
* www-dc.google.com
* www-ab.google.com
* www-in.google.com
* www-zu.google.com
* www-cw.google.com

During the Google Dance, you can check the 8 Google servers, and they will display sometime wildly differing results, thus they are said to be "dancing", and hence the name "Google Dance".

The easiest way to check if the Google Dance is happening is to go to www.google.com, and do a search. Look at the blue bar at the top of the page. It will have the words "Results 1 - 10 of about 626,000. Search took 0.48 seconds" Now check the same search on www2.google.com, and www3.google.com. If you are seeing a different number of total pages for the same search, then the Google Dance is on. You can also check all the variations above. www2 is really www-sj, and www3 is www-va. We have found that all the others need their full www-extension.google.com in the url if you want to test them properly. There are also a number of websites that feature tools that allow you to check all the indexes simultaneously, and compare results. Once the numbers, and the order of results on all 8 www's are the same, you know the dance is over.

Importance of The Google Dance

For most people, this event in and of itself is not important. However for anyone in the search engine optimization industry it is a period of note. First off, we always get lots of calls from clients during the Dance. Pages get temporarily dropped. Sometimes it lasts a day. People panic. Then when they are re added, they are better placed than before, and things calm down. It's interesting to see how overpoweringly important this one engine is.

The Technical Background of the Google Dance

The Google search engine pulls its results from more than 10,000 servers. This means that when you type a question or query into Google, that request is handled by one of 10,000 computers. Whichever server gets the query has to have an answer for you within a fraction of a second. Imagine putting all the books in the Library of Congress on the floor of an airplane hanger, and then asking for "sun tzu art of war", and expecting to be able to find the correct result in the blink of an eye. Impossible to imagine isn't it? Yet we ask the search engines to do this for us every day.

Google uses Linux servers. When the rebuild happens, all 10,000 of these servers are updated. Naturally, there will always be some variation from one index to the next just because there always are new sites being added, and content changes being made that affect the placement of some websites. But during the Google Dance, these variations are dramatic. One server after the other is updated with portions of the new index, until eventually, they are all updated with a completely new index database.

Google Dance and DNS

Not only is Google's index spread over more than 10,000 servers, but also these servers are in eight different data centers. These data centers are mainly located in the U.S.

Google uses multiple data centers to get results to the end user faster. If you access a data center that is physically close to you, then in theory, your connections needs to make less hops or navigate less intersections to get to the data center and back. Each data center has its own IP address (numerical address on the internet) and the Domain Name System (DNS) system manages the way that these IP addresses are accessed The system instantly routes your request to the nearest, or least congested data center. Its then routed within that data center facility to an idle server. In this way, Google is using a two step form of load balancing by its use of the DNS tables, and then internalized traffic management. Therefore, the distance for data transmissions can be reduced, and the speed of response improved.

During the Google Dance period, all the servers in all the data centers can not receive the new index at the same time. In fact, only portions of the new index can be transferred to each data center at one time, and each portion is transferred to one after the other. Different portions are uploaded to each server farm at different times, which also affects results. When a user queries Google during the Google Dance, they may get the results from a data center which still has all or part of the old index in place one minute, and then data from a data center which has new data a few minutes later. From the users perspective, the change took place within seconds.

Building up a completely new index every month or so can cause quite a bit of trouble. After all, the search engines have to spider and index billions of documents and then process the resulting data it has compiled into one cohesive unit. Thats no small feat.

During the period outside of the Dance, there may also be minor fluctuations in search results. This is because the index at the various data centers can never be identical to each other. New sites are constantly being added, old ones deleted, etc& It is estimated that over 8 million new web pages are created every day. Some of them are added to the search engines, and thus affect search results.

Now, if you want Googles definition of the Google Dance visit their page about the http://www.google.com/googledance2002 - Google Dance. Looks like fun, I'd go!


Google Page Rank

The image “http://upload.wikimedia.org/wikipedia/commons/thumb/2/2f/Linkstruct2.svg/507px-Linkstruct2.svg.png” cannot be displayed, because it contains errors.
http://en.wikipedia.org/wiki/PageRank#Google_Toolbar

link analysis algorithm that assigns a numerical weighting to each element of a hyperlinked set of documents, such as the World Wide Web, with the purpose of "measuring" its relative importance within the set. The algorithm may be applied to any collection of entities with reciprocal quotations and references. The numerical weight that it assigns to any given element E is also called the PageRank of E and denoted by PR(E).

PageRank was developed at Stanford University by Larry Page (hence the name Page-Rank[1]) and later Sergey Brin as part of a research project about a new kind of search engine. The project started in 1995 and led to a functional prototype, named Google, in 1998. Shortly after, Page and Brin founded Google Inc., the company behind the Google search engine. While just one of many factors which determine the ranking of Google search results, PageRank continues to provide the basis for all of Google's web search tools.[2]

The name PageRank is a trademark of Google. The PageRank process has been patented (U.S. Patent 6,285,999 ). The patent is not assigned to Google but to Stanford University.


General description


Google describes PageRank:[2]

PageRank relies on the uniquely democratic nature of the web by using its vast link structure as an indicator of an individual page's value. In essence, Google interprets a link from page A to page B as a vote, by page A, for page B. But, Google looks at more than the sheer volume of votes, or links a page receives; it also analyzes the page that casts the vote. Votes cast by pages that are themselves "important" weigh more heavily and help to make other pages "important".
A graphical representation of a web of links between sites used for PageRank calculations.
A graphical representation of a web of links between sites used for PageRank calculations.

In other words, a PageRank results from a "ballot" among all the other pages on the World Wide Web about how important a page is. A hyperlink to a page counts as a vote of support. The PageRank of a page is defined recursively and depends on the number and PageRank metric of all pages that link to it ("incoming links"). A page that is linked to by many pages with high PageRank receives a high rank itself. If there are no links to a web page there is no support for that page.

Google assigns a numeric weighting from 0-1 for each webpage on the Internet; this PageRank denotes your site’s importance in the eyes of Google. The scale for PageRank is logarithmic like the Richter Scale and roughly based upon quantity of inbound links as well as importance of the page providing the link.

Numerous academic papers concerning PageRank have been published since Page and Brin's original paper.[3] In practice, the PageRank concept has proven to be vulnerable to manipulation, and extensive research has been devoted to identifying falsely inflated PageRank and ways to ignore links from documents with falsely inflated PageRank.

Alternatives to the PageRank algorithm include the HITS algorithm proposed by Jon Kleinberg, the IBM CLEVER project and the TrustRank algorithm.

PageRank algorithm

probability distribution used to represent the likelihood that a person randomly clicking on links will arrive at any particular page. PageRank can be calculated for any-size collection of documents. It is assumed in several research papers that the distribution is evenly divided between all documents in the collection at the beginning of the computational process. The PageRank computations require several passes, called "iterations", through the collection to adjust approximate PageRank values to more closely reflect the theoretical true value.

A probability is expressed as a numeric value between 0 and 1. A 0.5 probability is commonly expressed as a "50% chance" of something happening. Hence, a PageRank of 0.5 means there is a 50% chance that a person clicking on a random link will be directed to the document with the 0.5 PageRank.

[edit] Simplified PageRank algorithm

Assume a small universe of four web pages: A, B, C and D. The initial approximation of PageRank would be evenly divided between these four documents. Hence, each document would begin with an estimated PageRank of 0.25.

If pages B, C, and D each only link to A, they would each confer 0.25 PageRank to A. All PageRank PR( ) in this simplistic system would thus gather to A because all links would be pointing to A.

PR(A)= PR(B) + PR(C) + PR(D).\,

But then suppose page B also has a link to page C, and page D has links to all three pages. The value of the link-votes is divided among all the outbound links on a page. Thus, page B gives a vote worth 0.125 to page A and a vote worth 0.125 to page C. Only one third of D's PageRank is counted for A's PageRank (approximately 0.083).

PR(A)= \frac{PR(B)}{2}+ \frac{PR(C)}{1}+ \frac{PR(D)}{3}.\,

In other words, the PageRank conferred by an outbound link L( ) is equal to the document's own PageRank score divided by the normalized number of outbound links (it is assumed that links to specific URLs only count once per document).

PR(A)= \frac{PR(B)}{L(B)}+ \frac{PR(C)}{L(C)}+ \frac{PR(D)}{L(D)}. \,

In the general case, the PageRank value for any page u can be expressed as:

PR(u) = \sum_{v \in B_u} \frac{PR(v)}{L(v)},

i.e. the PageRank value for a page u is dependent on the PageRank values for each page v out of the set Bu (this set contains all pages linking to page u), divided by the number L(v) of links from page v.

[edit] PageRank algorithm including damping factor

The PageRank theory holds that even an imaginary surfer who is randomly clicking on links will eventually stop clicking. The probability, at any step, that the person will continue is a damping factor d. Various studies have tested different damping factors, but it is generally assumed that the damping factor will be set around 0.85.[4]

The damping factor is subtracted from 1 (and in some variations of the algorithm, the result is divided by the number of documents in the collection) and this term is then added to the product of (the damping factor and the sum of the incoming PageRank scores).

That is,

PR(A)= 1 - d + d \left( \frac{PR(B)}{L(B)}+ \frac{PR(C)}{L(C)}+ \frac{PR(D)}{L(D)}+\,\cdots \right)

or (N = the number of documents in collection)

PR(A)= {1 - d \over N} + d \left( \frac{PR(B)}{L(B)}+ \frac{PR(C)}{L(C)}+ \frac{PR(D)}{L(D)}+\,\cdots \right) .

So any page's PageRank is derived in large part from the PageRanks of other pages. The damping factor adjusts the derived value downward. The second formula above supports the original statement in Page and Brin's paper that "the sum of all PageRanks is one".[3] Unfortunately, however, Page and Brin gave the first formula, which has led to some confusion.

Google recalculates PageRank scores each time it crawls the Web and rebuilds its index. As Google increases the number of documents in its collection, the initial approximation of PageRank decreases for all documents.

The formula uses a model of a random surfer who gets bored after several clicks and switches to a random page. The PageRank value of a page reflects the chance that the random surfer will land on that page by clicking on a link. It can be understood as a Markov chain in which the states are pages, and the transitions are all equally probable and are the links between pages.

If a page has no links to other pages, it becomes a sink and therefore terminates the random surfing process. However, the solution is quite simple. If the random surfer arrives at a sink page, it picks another URL at random and continues surfing again.

When calculating PageRank, pages with no outbound links are assumed to link out to all other pages in the collection. Their PageRank scores are therefore divided evenly among all other pages. In other words, to be fair with pages that are not sinks, these random transitions are added to all nodes in the Web, with a residual probability of usually d = 0.85, estimated from the frequency that an average surfer uses his or her browser's bookmark feature.

So, the equation is as follows:

PR(p_i) = \frac{1-d}{N} + d \sum_{p_j \in M(p_i)} \frac{PR (p_j)}{L(p_j)}

where p1,p2,...,pN are the pages under consideration, M(pi) is the set of pages that link to pi, L(pj) is the number of outbound links on page pj, and N is the total number of pages.

The PageRank values are the entries of the dominant eigenvector of the modified adjacency matrix. This makes PageRank a particularly elegant metric: the eigenvector is

\mathbf{R} = \begin{bmatrix} PR(p_1) \\ PR(p_2) \\ \vdots \\ PR(p_N) \end{bmatrix}

where R is the solution of the equation

\mathbf{R} =  \begin{bmatrix} {(1-d)/ N} \\ {(1-d) / N} \\ \vdots \\ {(1-d) / N} \end{bmatrix}  + d  \begin{bmatrix} \ell(p_1,p_1) & \ell(p_1,p_2) & \cdots & \ell(p_1,p_N) \\ \ell(p_2,p_1) & \ddots &  & \vdots \\ \vdots & & \ell(p_i,p_j) & \\ \ell(p_N,p_1) & \cdots & & \ell(p_N,p_N) \end{bmatrix}  \mathbf{R}

where the adjacency function \ell(p_i,p_j) is 0 if page pj does not link to pi, and normalised such that, for each j

\sum_{i = 1}^N \ell(p_i,p_j) = 1,

i.e. the elements of each column sum up to 1.

This is a variant of the eigenvector centrality measure used commonly in network analysis.

The values of the PageRank eigenvector are fast to approximate (only a few iterations are needed) and in practice it gives good results.

As a result of Markov theory, it can be shown that the PageRank of a page is the probability of being at that page after lots of clicks. This happens to equal t − 1 where t is the expectation of the number of clicks (or random jumps) required to get from the page back to itself.

The main disadvantage is that it favors older pages, because a new page, even a very good one, will not have many links unless it is part of an existing site (a site being a densely connected set of pages, such as Wikipedia). The Google Directory (itself a derivative of the Open Directory Project) allows users to see results sorted by PageRank within categories. The Google Directory is the only service offered by Google where PageRank directly determines display order. In Google's other search services (such as its primary Web search) PageRank is used to weight the relevance scores of pages shown in search results.

Several strategies have been proposed to accelerate the computation of PageRank.[5]

Various strategies to manipulate PageRank have been employed in concerted efforts to improve search results rankings and monetize advertising links. These strategies have severely impacted the reliability of the PageRank concept, which seeks to determine which documents are actually highly valued by the Web community.

Google is known to actively penalize link farms and other schemes designed to artificially inflate PageRank. How Google identifies link farms and other PageRank manipulation tools are among Google's trade secrets.

PageRank variations


Google Toolbar

An example of the PageRank indicator as found on the Google toolbar.
An example of the PageRank indicator as found on the Google toolbar.

The Google Toolbar's PageRank feature displays a visited page's PageRank as a whole number between 0 and 10. The most popular websites have a PageRank of 10. The least have a PageRank of 0. Google has not disclosed the precise method for determining a Toolbar PageRank value. Google representative Matt Cutts has publicly indicated that the Toolbar PageRank values are republished about once every three months, indicating that the Toolbar PageRank values are historical rather than real-time values.[6]

[edit] Google directory PageRank

The Google Directory PageRank is an 8-unit measurement. These values can be viewed in the Google Directory. Unlike the Google Toolbar which shows the PageRank value by a mouseover of the greenbar, the Google Directory does not show the PageRank as a numeric value but only as a green bar.

[edit] False or spoofed PageRank

While the PR shown in the Toolbar is considered to be derived from an accurate PageRank value (at some time prior to the time of publication by Google) for most sites, it must be noted that this value is also easily manipulated. A current flaw is that any low PageRank page that is redirected, via a 302 server header or a "Refresh" meta tag, to a high PR page causes the lower PR page to acquire the PR of the destination page. In theory a new, PR0 page with no incoming links can be redirected to the Google home page - which is a PR 10 - and by the next PageRank update the PR of the new page will be upgraded to a PR10. This spoofing technique, also known as 302 Google Jacking, is a known failing or bug in the system. Any page's PR can be spoofed to a higher or lower number of the webmaster's choice and only Google has access to the real PR of the page. Spoofing is generally detected by running a Google search for a URL with questionable PR, as the results will display the URL of an entirely different site (the one redirected to) in its results.

[edit] Manipulating PageRank

For search-engine optimization purposes, some companies offer to sell high PageRank links to webmasters.[7] As links from higher-PR pages are believed to be more valuable, they tend to be more expensive. It can be an effective and viable marketing strategy to buy link advertisements on content pages of quality and relevant sites to drive traffic and increase a webmaster's link popularity. However, Google has publicly warned webmasters that if they are or were discovered to be selling links for the purpose of conferring PageRank and reputation, their links will be devalued (ignored in the calculation of other pages' PageRanks). The practice of buying and selling links is intensely debated across the Webmastering community. Google advises webmasters to use the nofollow HTML attribute value on sponsored links. According to Matt Cutts, Google is concerned about webmasters who try to game the system, and thereby reduce the quality of Google search results.[7]

[edit] Other uses of PageRank

A version of PageRank has recently been proposed as a replacement for the traditional ISI impact factor,[8] and implemented at eigenfactor.org. Instead of merely counting total citation to a journal, the "importance" of each citation is determined in a PageRank fashion.

A similar new use of PageRank is to rank academic doctoral programs based on their records of placing their graduates in faculty positions. In PageRank terms, academic departments link to each other by hiring their faculty from each other (and from themselves).[9]

PageRank has also been used to automatically rank WordNet synsets according to how strongly they possess a given semantic property, such as positivity or negativity.[10]

A dynamic weighting method similar to PageRank has been used to generate customized reading lists based on the link structure of Wikipedia.[11]

A Web crawler may use PageRank as one of a number of importance metrics it uses to determine which URL to visit next during a crawl of the web. One of the early working papers[12] which were used in the creation of Google is Efficient crawling through URL ordering,[13] which discusses the use of a number of different importance metrics to determine how deeply, and how much of a site Google will crawl. PageRank is presented as one of a number of these importance metrics, though there are others listed such as the number of inbound and outbound links for a URL, and the distance from the root directory on a site to the URL.

Google's "rel='nofollow'" proposal


In early 2005, Google implemented a new value, "nofollow", for the rel attribute of HTML link and anchor elements, so that website builders and bloggers can make links that Google will not consider for the purposes of PageRank — they are links that no longer constitute a "vote" in the PageRank system. The nofollow relationship was added in an attempt to help combat spamdexing.

As an example, people could create many message-board posts with links to their website to artificially inflate their PageRank. Now, however, the message-board administrator can modify the code to automatically insert "rel='nofollow'" to all hyperlinks in posts, thus preventing PageRank from being affected by those particular posts.

This method of avoidance, however, also has various drawbacks, such as reducing the link value of actual comments. (See: Spam in blogs#rel="nofollow")

Search Engine Optimization is the way to promote your business online

Search Engine Optimization is the process in which your Website undergoes redevelopment to properly and best communicate your keywords to search engines. In order for your Website to rank highly among major search engines, you must understand how they become ranked. Search engines rank Websites based on two major factors: Unique content with pertinent keywords in the body, and link popularity - the number of quality incoming links your Website has. Other important algorithms that determine your ranking with search engines are the architecture of the site, visibility of your content, underlying code and how natural your site appears to the engines.

There are various things to note in website design element for properly optimizing your website for search engines:

Avoid Full page flash intros - Minimal of flash should be used in designing of your website. Flash is not readable by search engine spiders and hence spiders would not know what actually you want to promote on your website. Have a small flash like on the header. It will look good as well as not provide any hindrance in page being properly crawled by search engine spiders.

Avoid Frames - Avoid using frames in your website. Frames are not fully crawled by spiders. Either they are partially crawled or sometimes spiders don’t even crawl them.

JavaScript - Again spiders will find it difficult to crawl JavaScript links in your site. Links should be made in plain text in your website. If you use JavaScript links then spiders will not index all those pages. We have to get more and more pages crawled and indexed in search engines to get better rankings.

More of Text - Having a text rich site is always a bonus if you are aiming to top the search engines. Having a lot of text content in your site tells the search engine spiders what your site is all about. Your targeted keywords should appear all over your website. Apart from crawlers it is even better for the user/visitor to your website to find more relevant content. If they find your website useful, they will visit again.

e premte, 21 shtator 2007

Uniform Resource Identifier (URI)

By Shaikh Parvez

Introduction

A Uniform Resource Identifier (URI) provides a simple and extensible means for identifying a resource. This specification of URI syntax and semantics is derived from concepts introduced by the World Wide Web global information initiative, whose use of these identifiers dates from 1990 and is described in "Universal Resource Identifiers in WWW" [RFC1630]. The syntax is designed to meet the recommendations laid out in "Functional Recommendations for Internet Resource Locators" [RFC1736] and "Functional Requirements for Uniform Resource Names" [RFC1737].

This document obsoletes [RFC2396], which merged "Uniform Resource Locators" [RFC1738] and "Relative Uniform Resource Locators" [RFC1808] in order to define a single, generic syntax for all URIs. It obsoletes [RFC2732], which introduced syntax for an IPv6 address. It excludes portions of RFC 1738 that defined the specific syntax of individual URI schemes; those portions will be updated as separate documents. The process for registration of new URI schemes is defined separately by [BCP35]. Advice for designers of new URI schemes can be found in [RFC2718]. All significant changes from RFC 2396 are noted in Appendix D.

This specification uses the terms "character" and "coded character set" in accordance with the definitions provided in [BCP19], and "character encoding" in place of what [BCP19] refers to as a "charset".

1.1. Overview of URIs

URIs are characterized as follows:

Uniform

Uniformity provides several benefits. It allows different types of resource identifiers to be used in the same context, even when the mechanisms used to access those resources may differ. It allows uniform semantic interpretation of common syntactic conventions across different types of resource identifiers. It allows introduction of new types of resource identifiers without interfering with the way that existing identifiers are used. It allows the identifiers to be reused in many different contexts, thus permitting new applications or protocols to leverage a pre-existing, large, and widely used set of resource identifiers.

Resource

This specification does not limit the scope of what might be a resource; rather, the term "resource" is used in a general sense for whatever might be identified by a URI. Familiar examples include an electronic document, an image, a source of information with a consistent purpose (e.g., "today's weather report for Los Angeles"), a service (e.g., an HTTP-to-SMS gateway), and a collection of other resources. A resource is not necessarily accessible via the Internet; e.g., human beings, corporations, and bound books in a library can also be resources. Likewise, abstract concepts can be resources, such as the operators and operands of a mathematical equation, the types of a relationship (e.g., "parent" or "employee"), or numeric values (e.g., zero, one, and infinity).

Identifier

An identifier embodies the information required to distinguish what is being identified from all other things within its scope of identification. Our use of the terms "identify" and "identifying" refer to this purpose of distinguishing one resource from all other resources, regardless of how that purpose is accomplished (e.g., by name, address, or context). These terms should not be mistaken as an assumption that an identifier defines or embodies the identity of what is referenced, though that may be the case for some identifiers. Nor should it be assumed that a system using URIs will access the resource identified: in many cases, URIs are used to denote resources without any intention that they be accessed. Likewise, the "one" resource identified might not be singular in nature (e.g., a resource might be a named set or a mapping that varies over time).

A URI is an identifier consisting of a sequence of characters matching the syntax rule named in Section 3. It enables uniform identification of resources via a separately defined extensible set of naming schemes (Section 3.1). How that identification is accomplished, assigned, or enabled is delegated to each scheme specification.

This specification does not place any limits on the nature of a resource, the reasons why an application might seek to refer to a resource, or the kinds of systems that might use URIs for the sake of identifying resources. This specification does not require that a URI persists in identifying the same resource over time, though that is a common goal of all URI schemes. Nevertheless, nothing in this specification prevents an application from limiting itself to particular types of resources, or to a subset of URIs that maintains characteristics desired by that application.

URIs have a global scope and are interpreted consistently regardless of context, though the result of that interpretation may be in relation to the end-user's context. For example, "http://localhost/" has the same interpretation for every user of that reference, even though the network interface corresponding to "localhost" may be different for each end-user: interpretation is independent of access. However, an action made on the basis of that reference will take place in relation to the end-user's context, which implies that an action intended to refer to a globally unique thing must use a URI that distinguishes that resource from all other things. URIs that identify in relation to the end-user's local context should only be used when the context itself is a defining aspect of the resource, such as when an on-line help manual refers to a file on the end-user's file system (e.g., "file:///etc/hosts").

Generic Syntax

Each URI begins with a scheme name, as defined in Section 3.1, that refers to a specification for assigning identifiers within that scheme. As such, the URI syntax is a federated and extensible naming system wherein each scheme's specification may further restrict the syntax and semantics of identifiers using that scheme.

This specification defines those elements of the URI syntax that are required of all URI schemes or are common to many URI schemes. It thus defines the syntax and semantics needed to implement a scheme-independent parsing mechanism for URI references, by which the scheme-dependent handling of a URI can be postponed until the scheme-dependent semantics are needed. Likewise, protocols and data formats that make use of URI references can refer to this specification as a definition for the range of syntax allowed for all URIs, including those schemes that have yet to be defined. This decouples the evolution of identification schemes from the evolution of protocols, data formats, and implementations that make use of URIs.

A parser of the generic URI syntax can parse any URI reference into its major components. Once the scheme is determined, further scheme-specific parsing can be performed on the components. In other words, the URI generic syntax is a superset of the syntax of all URI schemes.

Examples

The following example URIs illustrate several URI schemes and variations in their common syntax components:

   ftp://ftp.is.co.za/rfc/rfc1808.txt

http://www.ietf.org/rfc/rfc2396.txt

ldap://[2001:db8::7]/c=GB?objectClass?one

mailto:John.Doe@example.com

news:comp.infosystems.www.servers.unix

tel:+1-816-555-1212

telnet://192.0.2.16:80/

urn:oasis:names:specification:docbook:dtd:xml:4.1.2

URI, URL, and URN

A URI can be further classified as a locator, a name, or both. The term "Uniform Resource Locator" (URL) refers to the subset of URIs that, in addition to identifying a resource, provide a means of locating the resource by describing its primary access mechanism (e.g., its network "location"). The term "Uniform Resource Name" (URN) has been used historically to refer to both URIs under the "urn" scheme [RFC2141], which are required to remain globally unique and persistent even when the resource ceases to exist or becomes unavailable, and to any other URI with the properties of a name.

An individual scheme does not have to be classified as being just one of "name" or "locator". Instances of URIs from any given scheme may have the characteristics of names or locators or both, often depending on the persistence and care in the assignment of identifiers by the naming authority, rather than on any quality of the scheme. Future specifications and related documentation should use the general term "URI" rather than the more restrictive terms "URL" and "URN" [RFC3305].

Design Considerations

Transcription

The URI syntax has been designed with global transcription as one of its main considerations. A URI is a sequence of characters from a very limited set: the letters of the basic Latin alphabet, digits, and a few special characters. A URI may be represented in a variety of ways; e.g., ink on paper, pixels on a screen, or a sequence of character encoding octets. The interpretation of a URI depends only on the characters used and not on how those characters are represented in a network protocol.

The goal of transcription can be described by a simple scenario. Imagine two colleagues, Sam and Kim, sitting in a pub at an international conference and exchanging research ideas. Sam asks Kim for a location to get more information, so Kim writes the URI for the research site on a napkin. Upon returning home, Sam takes out the napkin and types the URI into a computer, which then retrieves the information to which Kim referred.

There are several design considerations revealed by the scenario:

  • A URI is a sequence of characters that is not always represented as a sequence of octets.
  • A URI might be transcribed from a non-network source and thus should consist of characters that are most likely able to be entered into a computer, within the constraints imposed by keyboards (and related input devices) across languages and locales.
  • A URI often has to be remembered by people, and it is easier for people to remember a URI when it consists of meaningful or familiar components.

These design considerations are not always in alignment. For example, it is often the case that the most meaningful name for a URI component would require characters that cannot be typed into some systems. The ability to transcribe a resource identifier from one medium to another has been considered more important than having a URI consist of the most meaningful of components.

In local or regional contexts and with improving technology, users might benefit from being able to use a wider range of characters; such use is not defined by this specification. Percent-encoded octets (Section 2.1) may be used within a URI to represent characters outside the range of the US-ASCII coded character set if this representation is allowed by the scheme or by the protocol element in which the URI is referenced. Such a definition should specify the character encoding used to map those characters to octets prior to being percent-encoded for the URI.

Separating Identification from Interaction

A common misunderstanding of URIs is that they are only used to refer to accessible resources. The URI itself only provides identification; access to the resource is neither guaranteed nor implied by the presence of a URI. Instead, any operation associated with a URI reference is defined by the protocol element, data format attribute, or natural language text in which it appears.

Given a URI, a system may attempt to perform a variety of operations on the resource, as might be characterized by words such as "access", "update", "replace", or "find attributes". Such operations are defined by the protocols that make use of URIs, not by this specification. However, we do use a few general terms for describing common operations on URIs. URI "resolution" is the process of determining an access mechanism and the appropriate parameters necessary to dereference a URI; this resolution may require several iterations. To use that access mechanism to perform an action on the URI's resource is to "dereference" the URI.

When URIs are used within information retrieval systems to identify sources of information, the most common form of URI dereference is "retrieval": making use of a URI in order to retrieve a representation of its associated resource. A "representation" is a sequence of octets, along with representation metadata describing those octets, that constitutes a record of the state of the resource at the time when the representation is generated. Retrieval is achieved by a process that might include using the URI as a cache key to check for a locally cached representation, resolution of the URI to determine an appropriate access mechanism (if any), and dereference of the URI for the sake of applying a retrieval operation. Depending on the protocols used to perform the retrieval, additional information might be supplied about the resource (resource metadata) and its relation to other resources.

URI references in information retrieval systems are designed to be late-binding: the result of an access is generally determined when it is accessed and may vary over time or due to other aspects of the interaction. These references are created in order to be used in the future: what is being identified is not some specific result that was obtained in the past, but rather some characteristic that is expected to be true for future results. In such cases, the resource referred to by the URI is actually a sameness of characteristics as observed over time, perhaps elucidated by additional comments or assertions made by the resource provider.

Although many URI schemes are named after protocols, this does not imply that use of these URIs will result in access to the resource via the named protocol. URIs are often used simply for the sake of identification. Even when a URI is used to retrieve a representation of a resource, that access might be through gateways, proxies, caches, and name resolution services that are independent of the protocol associated with the scheme name. The resolution of some URIs may require the use of more than one protocol (e.g., both DNS and HTTP are typically used to access an "http" URI's origin server when a representation isn't found in a local cache).

Hierarchical Identifiers

The URI syntax is organized hierarchically, with components listed in order of decreasing significance from left to right. For some URI schemes, the visible hierarchy is limited to the scheme itself: everything after the scheme component delimiter (":") is considered opaque to URI processing. Other URI schemes make the hierarchy explicit and visible to generic parsing algorithms.

The generic syntax uses the slash ("/"), question mark ("?"), and number sign ("#") characters to delimit components that are significant to the generic parser's hierarchical interpretation of an identifier. In addition to aiding the readability of such identifiers through the consistent use of familiar syntax, this uniform representation of hierarchy across naming schemes allows scheme-independent references to be made relative to that hierarchy.

It is often the case that a group or "tree" of documents has been constructed to serve a common purpose, wherein the vast majority of URI references in these documents point to resources within the tree rather than outside it. Similarly, documents located at a particular site are much more likely to refer to other resources at that site than to resources at remote sites. Relative referencing of URIs allows document trees to be partially independent of their location and access scheme. For instance, it is possible for a single set of hypertext documents to be simultaneously accessible and traversable via each of the "file", "http", and "ftp" schemes if the documents refer to each other with relative references. Furthermore, such document trees can be moved, as a whole, without changing any of the relative references.

A relative reference (Section 4.2) refers to a resource by describing the difference within a hierarchical name space between the reference context and the target URI. The reference resolution algorithm, presented in Section 5, defines how such a reference is transformed to the target URI. As relative references can only be used within the context of a hierarchical URI, designers of new URI schemes should use a syntax consistent with the generic syntax's hierarchical components unless there are compelling reasons to forbid relative referencing within that scheme.

NOTE: Previous specifications used the terms "partial URI" and "relative URI" to denote a relative reference to a URI. As some readers misunderstood those terms to mean that relative URIs are a subset of URIs rather than a method of referencing URIs, this specification simply refers to them as relative references.

All URI references are parsed by generic syntax parsers when used. However, because hierarchical processing has no effect on an absolute URI used in a reference unless it contains one or more dot-segments (complete path segments of "." or "..", as described in Section 3.3), URI scheme specifications can define opaque identifiers by disallowing use of slash characters, question mark characters, and the URIs "scheme:." and "scheme:..".

Syntax Notation

This specification uses the Augmented Backus-Naur Form (ABNF) notation of [RFC2234], including the following core ABNF syntax rules defined by that specification: ALPHA (letters), CR (carriage return), DIGIT (decimal digits), DQUOTE (double quote), HEXDIG (hexadecimal digits), LF (line feed), and SP (space). The complete URI syntax is collected in Appendix A.

Characters

The URI syntax provides a method of encoding data, presumably for the sake of identifying a resource, as a sequence of characters. The URI characters are, in turn, frequently encoded as octets for transport or presentation. This specification does not mandate any particular character encoding for mapping between URI characters and the octets used to store or transmit those characters. When a URI appears in a protocol element, the character encoding is defined by that protocol; without such a definition, a URI is assumed to be in the same character encoding as the surrounding text.

The ABNF notation defines its terminal values to be non-negative integers (codepoints) based on the US-ASCII coded character set [ASCII]. Because a URI is a sequence of characters, we must invert that relation in order to understand the URI syntax. Therefore, the integer values used by the ABNF must be mapped back to their corresponding characters via US-ASCII in order to complete the syntax rules.

A URI is composed from a limited set of characters consisting of digits, letters, and a few graphic symbols. A reserved subset of those characters may be used to delimit syntax components within a URI while the remaining characters, including both the unreserved set and those reserved characters not acting as delimiters, define each component's identifying data.

Percent-Encoding

A percent-encoding mechanism is used to represent a data octet in a component when that octet's corresponding character is outside the allowed set or is being used as a delimiter of, or within, the component. A percent-encoded octet is encoded as a character triplet, consisting of the percent character "%" followed by the two hexadecimal digits representing that octet's numeric value. For example, "%20" is the percent-encoding for the binary octet "00100000" (ABNF: %x20), which in US-ASCII corresponds to the space character (SP). Section 2.4 describes when percent-encoding and decoding is applied.

   pct-encoded = "%" HEXDIG HEXDIG

The uppercase hexadecimal digits 'A' through 'F' are equivalent to the lowercase digits 'a' through 'f', respectively. If two URIs differ only in the case of hexadecimal digits used in percent-encoded octets, they are equivalent. For consistency, URI producers and normalizers should use uppercase hexadecimal digits for all percent-encodings.

Reserved Characters

URIs include components and subcomponents that are delimited by characters in the "reserved" set. These characters are called "reserved" because they may (or may not) be defined as delimiters by the generic syntax, by each scheme-specific syntax, or by the implementation-specific syntax of a URI's dereferencing algorithm. If data for a URI component would conflict with a reserved character's purpose as a delimiter, then the conflicting data must be percent-encoded before the URI is formed.

   reserved    = gen-delims / sub-delims

gen-delims = ":" / "/" / "?" / "#" / "[" / "]" / "@"

sub-delims = "!" / "$" / "&" / "'" / "(" / ")"
/ "*" / "+" / "," / ";" / "="

The purpose of reserved characters is to provide a set of delimiting characters that are distinguishable from other data within a URI. URIs that differ in the replacement of a reserved character with its corresponding percent-encoded octet are not equivalent. Percent-encoding a reserved character, or decoding a percent-encoded octet that corresponds to a reserved character, will change how the URI is interpreted by most applications. Thus, characters in the reserved set are protected from normalization and are therefore safe to be used by scheme-specific and producer-specific algorithms for delimiting data subcomponents within a URI.

A subset of the reserved characters (gen-delims) is used as delimiters of the generic URI components described in Section 3. A component's ABNF syntax rule will not use the reserved or gen-delims rule names directly; instead, each syntax rule lists the characters allowed within that component (i.e., not delimiting it), and any of those characters that are also in the reserved set are "reserved" for use as subcomponent delimiters within the component. Only the most common subcomponents are defined by this specification; other subcomponents may be defined by a URI scheme's specification, or by the implementation-specific syntax of a URI's dereferencing algorithm, provided that such subcomponents are delimited by characters in the reserved set allowed within that component.

URI producing applications should percent-encode data octets that correspond to characters in the reserved set unless these characters are specifically allowed by the URI scheme to represent data in that component. If a reserved character is found in a URI component and no delimiting role is known for that character, then it must be interpreted as representing the data octet corresponding to that character's encoding in US-ASCII.

Unreserved Characters

Characters that are allowed in a URI but do not have a reserved purpose are called unreserved. These include uppercase and lowercase letters, decimal digits, hyphen, period, underscore, and tilde.

   unreserved  = ALPHA / DIGIT / "-" / "." / "_" / "~"

URIs that differ in the replacement of an unreserved character with its corresponding percent-encoded US-ASCII octet are equivalent: they identify the same resource. However, URI comparison implementations do not always perform normalization prior to comparison (see Section 6). For consistency, percent-encoded octets in the ranges of ALPHA (%41-%5A and %61-%7A), DIGIT (%30-%39), hyphen (%2D), period (%2E), underscore (%5F), or tilde (%7E) should not be created by URI producers and, when found in a URI, should be decoded to their corresponding unreserved characters by URI normalizers.

When to Encode or Decode

Under normal circumstances, the only time when octets within a URI are percent-encoded is during the process of producing the URI from its component parts. This is when an implementation determines which of the reserved characters are to be used as subcomponent delimiters and which can be safely used as data. Once produced, a URI is always in its percent-encoded form.

When a URI is dereferenced, the components and subcomponents significant to the scheme-specific dereferencing process (if any) must be parsed and separated before the percent-encoded octets within those components can be safely decoded, as otherwise the data may be mistaken for component delimiters. The only exception is for percent-encoded octets corresponding to characters in the unreserved set, which can be decoded at any time. For example, the octet corresponding to the tilde ("~") character is often encoded as "%7E" by older URI processing implementations; the "%7E" can be replaced by "~" without changing its interpretation.

Because the percent ("%") character serves as the indicator for percent-encoded octets, it must be percent-encoded as "%25" for that octet to be used as data within a URI. Implementations must not percent-encode or decode the same string more than once, as decoding an already decoded string might lead to misinterpreting a percent data octet as the beginning of a percent-encoding, or vice versa in the case of percent-encoding an already percent-encoded string.

Identifying Data

URI characters provide identifying data for each of the URI components, serving as an external interface for identification between systems. Although the presence and nature of the URI production interface is hidden from clients that use its URIs (and is thus beyond the scope of the interoperability requirements defined by this specification), it is a frequent source of confusion and errors in the interpretation of URI character issues. Implementers have to be aware that there are multiple character encodings involved in the production and transmission of URIs: local name and data encoding, public interface encoding, URI character encoding, data format encoding, and protocol encoding.

Local names, such as file system names, are stored with a local character encoding. URI producing applications (e.g., origin servers) will typically use the local encoding as the basis for producing meaningful names. The URI producer will transform the local encoding to one that is suitable for a public interface and then transform the public interface encoding into the restricted set of URI characters (reserved, unreserved, and percent-encodings). Those characters are, in turn, encoded as octets to be used as a reference within a data format (e.g., a document charset), and such data formats are often subsequently encoded for transmission over Internet protocols.

For most systems, an unreserved character appearing within a URI component is interpreted as representing the data octet corresponding to that character's encoding in US-ASCII. Consumers of URIs assume that the letter "X" corresponds to the octet "01011000", and even when that assumption is incorrect, there is no harm in making it. A system that internally provides identifiers in the form of a different character encoding, such as EBCDIC, will generally perform character translation of textual identifiers to UTF-8 [STD63] (or some other superset of the US-ASCII character encoding) at an internal interface, thereby providing more meaningful identifiers than those resulting from simply percent-encoding the original octets.

For example, consider an information service that provides data, stored locally using an EBCDIC-based file system, to clients on the Internet through an HTTP server. When an author creates a file with the name "Laguna Beach" on that file system, the "http" URI corresponding to that resource is expected to contain the meaningful string "Laguna%20Beach". If, however, that server produces URIs by using an overly simplistic raw octet mapping, then the result would be a URI containing "%D3%81%87%A4%95%81@%C2%85%81%83%88". An internal transcoding interface fixes this problem by transcoding the local name to a superset of US-ASCII prior to producing the URI. Naturally, proper interpretation of an incoming URI on such an interface requires that percent-encoded octets be decoded (e.g., "%20" to SP) before the reverse transcoding is applied to obtain the local name.

In some cases, the internal interface between a URI component and the identifying data that it has been crafted to represent is much less direct than a character encoding translation. For example, portions of a URI might reflect a query on non-ASCII data, or numeric coordinates on a map. Likewise, a URI scheme may define components with additional encoding requirements that are applied prior to forming the component and producing the URI.

When a new URI scheme defines a component that represents textual data consisting of characters from the Universal Character Set [UCS], the data should first be encoded as octets according to the UTF-8 character encoding [STD63]; then only those octets that do not correspond to characters in the unreserved set should be percent-encoded. For example, the character A would be represented as "A", the character LATIN CAPITAL LETTER A WITH GRAVE would be represented as "%C3%80", and the character KATAKANA LETTER A would be represented as "%E3%82%A2".

Syntax Components

The generic URI syntax consists of a hierarchical sequence of components referred to as the scheme, authority, path, query, and fragment.

   URI         = scheme ":" hier-part [ "?" query ] [ "#" fragment ]

hier-part = "//" authority path-abempty
/ path-absolute
/ path-rootless
/ path-empty

The scheme and path components are required, though the path may be empty (no characters). When authority is present, the path must either be empty or begin with a slash ("/") character. When authority is not present, the path cannot begin with two slash characters ("//"). These restrictions result in five different ABNF rules for a path (Section 3.3), only one of which will match any given URI reference.

The following are two example URIs and their component parts:

      foo://example.com:8042/over/there?name=ferret#nose
\_/ \______________/\_________/ \_________/ \__/
| | | | |
scheme authority path query fragment
| _____________________|__
/ \ / \
urn:example:animal:ferret:nose

Scheme

Each URI begins with a scheme name that refers to a specification for assigning identifiers within that scheme. As such, the URI syntax is a federated and extensible naming system wherein each scheme's specification may further restrict the syntax and semantics of identifiers using that scheme.

Scheme names consist of a sequence of characters beginning with a letter and followed by any combination of letters, digits, plus ("+"), period ("."), or hyphen ("-"). Although schemes are case-insensitive, the canonical form is lowercase and documents that specify schemes must do so with lowercase letters. An implementation should accept uppercase letters as equivalent to lowercase in scheme names (e.g., allow "HTTP" as well as "http") for the sake of robustness but should only produce lowercase scheme names for consistency.

   scheme      = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )

Individual schemes are not specified by this document. The process for registration of new URI schemes is defined separately by [BCP35]. The scheme registry maintains the mapping between scheme names and their specifications. Advice for designers of new URI schemes can be found in [RFC2718]. URI scheme specifications must define their own syntax so that all strings matching their scheme-specific syntax will also match the grammar, as described in Section 4.3.

When presented with a URI that violates one or more scheme-specific restrictions, the scheme-specific resolution process should flag the reference as an error rather than ignore the unused parts; doing so reduces the number of equivalent URIs and helps detect abuses of the generic syntax, which might indicate that the URI has been constructed to mislead the user (Section 7.6).

Authority

Many URI schemes include a hierarchical element for a naming authority so that governance of the name space defined by the remainder of the URI is delegated to that authority (which may, in turn, delegate it further). The generic syntax provides a common means for distinguishing an authority based on a registered name or server address, along with optional port and user information.

The authority component is preceded by a double slash ("//") and is terminated by the next slash ("/"), question mark ("?"), or number sign ("#") character, or by the end of the URI.

   authority   = [ userinfo "@" ] host [ ":" port ]

URI producers and normalizers should omit the ":" delimiter that separates host from port if the port component is empty. Some schemes do not allow the userinfo and/or port subcomponents.

If a URI contains an authority component, then the path component must either be empty or begin with a slash ("/") character. Non-validating parsers (those that merely separate a URI reference into its major components) will often ignore the subcomponent structure of authority, treating it as an opaque string from the double-slash to the first terminating delimiter, until such time as the URI is dereferenced.

User Information

The userinfo subcomponent may consist of a user name and, optionally, scheme-specific information about how to gain authorization to access the resource. The user information, if present, is followed by a commercial at-sign ("@") that delimits it from the host.

   userinfo    = *( unreserved / pct-encoded / sub-delims / ":" )

Use of the format "user:password" in the userinfo field is deprecated. Applications should not render as clear text any data after the first colon (":") character found within a userinfo subcomponent unless the data after the colon is the empty string (indicating no password). Applications may choose to ignore or reject such data when it is received as part of a reference and should reject the storage of such data in unencrypted form. The passing of authentication information in clear text has proven to be a security risk in almost every case where it has been used.

Applications that render a URI for the sake of user feedback, such as in graphical hypertext browsing, should render userinfo in a way that is distinguished from the rest of a URI, when feasible. Such rendering will assist the user in cases where the userinfo has been misleadingly crafted to look like a trusted domain name (Section 7.6).

Host

The host subcomponent of authority is identified by an IP literal encapsulated within square brackets, an IPv4 address in dotted-decimal form, or a registered name. The host subcomponent is case-insensitive. The presence of a host subcomponent within a URI does not imply that the scheme requires access to the given host on the Internet. In many cases, the host syntax is used only for the sake of reusing the existing registration process created and deployed for DNS, thus obtaining a globally unique name without the cost of deploying another registry. However, such use comes with its own costs: domain name ownership may change over time for reasons not anticipated by the URI producer. In other cases, the data within the host component identifies a registered name that has nothing to do with an Internet host. We use the name "host" for the ABNF rule because that is its most common purpose, not its only purpose.

   host        = IP-literal / IPv4address / reg-name

The syntax rule for host is ambiguous because it does not completely distinguish between an IPv4address and a reg-name. In order to disambiguate the syntax, we apply the "first-match-wins" algorithm: If host matches the rule for IPv4address, then it should be considered an IPv4 address literal and not a reg-name. Although host is case-insensitive, producers and normalizers should use lowercase for registered names and hexadecimal addresses for the sake of uniformity, while only using uppercase letters for percent-encodings.

A host identified by an Internet Protocol literal address, version 6 [RFC3513] or later, is distinguished by enclosing the IP literal within square brackets ("[" and "]"). This is the only place where square bracket characters are allowed in the URI syntax. In anticipation of future, as-yet-undefined IP literal address formats, an implementation may use an optional version flag to indicate such a format explicitly rather than rely on heuristic determination.

   IP-literal = "[" ( IPv6address / IPvFuture  ) "]"

IPvFuture = "v" 1*HEXDIG "." 1*( unreserved / sub-delims / ":" )

The version flag does not indicate the IP version; rather, it indicates future versions of the literal format. As such, implementations must not provide the version flag for the existing IPv4 and IPv6 literal address forms described below. If a URI containing an IP-literal that starts with "v" (case-insensitive), indicating that the version flag is present, is dereferenced by an application that does not know the meaning of that version flag, then the application should return an appropriate error for "address mechanism not supported".

A host identified by an IPv6 literal address is represented inside the square brackets without a preceding version flag. The ABNF provided here is a translation of the text definition of an IPv6 literal address provided in [RFC3513]. This syntax does not support IPv6 scoped addressing zone identifiers.

A 128-bit IPv6 address is divided into eight 16-bit pieces. Each piece is represented numerically in case-insensitive hexadecimal, using one to four hexadecimal digits (leading zeroes are permitted). The eight encoded pieces are given most-significant first, separated by colon characters. Optionally, the least-significant two pieces may instead be represented in IPv4 address textual format. A sequence of one or more consecutive zero-valued 16-bit pieces within the address may be elided, omitting all their digits and leaving exactly two consecutive colons in their place to mark the elision.

   IPv6address =                            6( h16 ":" ) ls32
/ "::" 5( h16 ":" ) ls32
/ [ h16 ] "::" 4( h16 ":" ) ls32
/ [ *1( h16 ":" ) h16 ] "::" 3( h16 ":" ) ls32
/ [ *2( h16 ":" ) h16 ] "::" 2( h16 ":" ) ls32
/ [ *3( h16 ":" ) h16 ] "::" h16 ":" ls32
/ [ *4( h16 ":" ) h16 ] "::" ls32
/ [ *5( h16 ":" ) h16 ] "::" h16
/ [ *6( h16 ":" ) h16 ] "::"

ls32 = ( h16 ":" h16 ) / IPv4address
; least-significant 32 bits of address

h16 = 1*4HEXDIG
; 16 bits of address represented in hexadecimal

A host identified by an IPv4 literal address is represented in dotted-decimal notation (a sequence of four decimal numbers in the range 0 to 255, separated by "."), as described in [RFC1123] by reference to [RFC0952]. Note that other forms of dotted notation may be interpreted on some platforms, as described in Section 7.4, but only the dotted-decimal form of four octets is allowed by this grammar.

   IPv4address = dec-octet "." dec-octet "." dec-octet "." dec-octet

dec-octet = DIGIT ; 0-9
/ %x31-39 DIGIT ; 10-99
/ "1" 2DIGIT ; 100-199
/ "2" %x30-34 DIGIT ; 200-249
/ "25" %x30-35 ; 250-255

A host identified by a registered name is a sequence of characters usually intended for lookup within a locally defined host or service name registry, though the URI's scheme-specific semantics may require that a specific registry (or fixed name table) be used instead. The most common name registry mechanism is the Domain Name System (DNS). A registered name intended for lookup in the DNS uses the syntax defined in Section 3.5 of [RFC1034] and Section 2.1 of [RFC1123]. Such a name consists of a sequence of domain labels separated by ".", each domain label starting and ending with an alphanumeric character and possibly also containing "-" characters. The rightmost domain label of a fully qualified domain name in DNS may be followed by a single "." and should be if it is necessary to distinguish between the complete domain name and some local domain.

   reg-name    = *( unreserved / pct-encoded / sub-delims )

If the URI scheme defines a default for host, then that default applies when the host subcomponent is undefined or when the registered name is empty (zero length). For example, the "file" URI scheme is defined so that no authority, an empty host, and "localhost" all mean the end-user's machine, whereas the "http" scheme considers a missing authority or empty host invalid.

This specification does not mandate a particular registered name lookup technology and therefore does not restrict the syntax of reg-name beyond what is necessary for interoperability. Instead, it delegates the issue of registered name syntax conformance to the operating system of each application performing URI resolution, and that operating system decides what it will allow for the purpose of host identification. A URI resolution implementation might use DNS, host tables, yellow pages, NetInfo, WINS, or any other system for lookup of registered names. However, a globally scoped naming system, such as DNS fully qualified domain names, is necessary for URIs intended to have global scope. URI producers should use names that conform to the DNS syntax, even when use of DNS is not immediately apparent, and should limit these names to no more than 255 characters in length.

The reg-name syntax allows percent-encoded octets in order to represent non-ASCII registered names in a uniform way that is independent of the underlying name resolution technology. Non-ASCII characters must first be encoded according to UTF-8 [STD63], and then each octet of the corresponding UTF-8 sequence must be percent-encoded to be represented as URI characters. URI producing applications must not use percent-encoding in host unless it is used to represent a UTF-8 character sequence. When a non-ASCII registered name represents an internationalized domain name intended for resolution via the DNS, the name must be transformed to the IDNA encoding [RFC3490] prior to name lookup. URI producers should provide these registered names in the IDNA encoding, rather than a percent-encoding, if they wish to maximize interoperability with legacy URI resolvers.

Port

The port subcomponent of authority is designated by an optional port number in decimal following the host and delimited from it by a single colon (":") character.

   port        = *DIGIT

A scheme may define a default port. For example, the "http" scheme defines a default port of "80", corresponding to its reserved TCP port number. The type of port designated by the port number (e.g., TCP, UDP, SCTP) is defined by the URI scheme. URI producers and normalizers should omit the port component and its ":" delimiter if port is empty or if its value would be the same as that of the scheme's default.

Path

The path component contains data, usually organized in hierarchical form, that, along with data in the non-hierarchical query component, serves to identify a resource within the scope of the URI's scheme and naming authority (if any). The path is terminated by the first question mark ("?") or number sign ("#") character, or by the end of the URI.

If a URI contains an authority component, then the path component must either be empty or begin with a slash ("/") character. If a URI does not contain an authority component, then the path cannot begin with two slash characters ("//"). In addition, a URI reference (Section 4.1) may be a relative-path reference, in which case the first path segment cannot contain a colon (":") character. The ABNF requires five separate rules to disambiguate these cases, only one of which will match the path substring within a given URI reference. We use the generic term "path component" to describe the URI substring matched by the parser to one of these rules.

   path          = path-abempty    ; begins with "/" or is empty
/ path-absolute ; begins with "/" but not "//"
/ path-noscheme ; begins with a non-colon segment
/ path-rootless ; begins with a segment
/ path-empty ; zero characters

path-abempty = *( "/" segment )
path-absolute = "/" [ segment-nz *( "/" segment ) ]
path-noscheme = segment-nz-nc *( "/" segment )
path-rootless = segment-nz *( "/" segment )
path-empty = 0

segment = *pchar
segment-nz = 1*pchar
segment-nz-nc = 1*( unreserved / pct-encoded / sub-delims / "@" )
; non-zero-length segment without any colon ":"

pchar = unreserved / pct-encoded / sub-delims / ":" / "@"

A path consists of a sequence of path segments separated by a slash ("/") character. A path is always defined for a URI, though the defined path may be empty (zero length). Use of the slash character to indicate hierarchy is only required when a URI will be used as the context for relative references. For example, the URI has a path of "fred@example.com", whereas the URI has an empty path.

The path segments "." and "..", also known as dot-segments, are defined for relative reference within the path name hierarchy. They are intended for use at the beginning of a relative-path reference (Section 4.2) to indicate relative position within the hierarchical tree of names. This is similar to their role within some operating systems' file directory structures to indicate the current directory and parent directory, respectively. However, unlike in a file system, these dot-segments are only interpreted within the URI path hierarchy and are removed as part of the resolution process (Section 5.2).

Aside from dot-segments in hierarchical paths, a path segment is considered opaque by the generic syntax. URI producing applications often use the reserved characters allowed in a segment to delimit scheme-specific or dereference-handler-specific subcomponents. For example, the semicolon (";") and equals ("=") reserved characters are often used to delimit parameters and parameter values applicable to that segment. The comma (",") reserved character is often used for similar purposes. For example, one URI producer might use a segment such as "name;v=1.1" to indicate a reference to version 1.1 of "name", whereas another might use a segment such as "name,1.1" to indicate the same. Parameter types may be defined by scheme-specific semantics, but in most cases the syntax of a parameter is specific to the implementation of the URI's dereferencing algorithm.

Query

The query component contains non-hierarchical data that, along with data in the path component, serves to identify a resource within the scope of the URI's scheme and naming authority (if any). The query component is indicated by the first question mark ("?") character and terminated by a number sign ("#") character or by the end of the URI.

   query       = *( pchar / "/" / "?" )

The characters slash ("/") and question mark ("?") may represent data within the query component. Beware that some older, erroneous implementations may not handle such data correctly when it is used as the base URI for relative references (Section 5.1), apparently because they fail to distinguish query data from path data when looking for hierarchical separators. However, as query components are often used to carry identifying information in the form of "key=value" pairs and one frequently used value is a reference to another URI, it is sometimes better for usability to avoid percent-encoding those characters.

Fragment

The fragment identifier component of a URI allows indirect identification of a secondary resource by reference to a primary resource and additional identifying information. The identified secondary resource may be some portion or subset of the primary resource, some view on representations of the primary resource, or some other resource defined or described by those representations. A fragment identifier component is indicated by the presence of a number sign ("#") character and terminated by the end of the URI.

   fragment    = *( pchar / "/" / "?" )

The semantics of a fragment identifier are defined by the set of representations that might result from a retrieval action on the primary resource. The fragment's format and resolution is therefore dependent on the media type [RFC2046] of a potentially retrieved representation, even though such a retrieval is only performed if the URI is dereferenced. If no such representation exists, then the semantics of the fragment are considered unknown and are effectively unconstrained. Fragment identifier semantics are independent of the URI scheme and thus cannot be redefined by scheme specifications.

Individual media types may define their own restrictions on or structures within the fragment identifier syntax for specifying different types of subsets, views, or external references that are identifiable as secondary resources by that media type. If the primary resource has multiple representations, as is often the case for resources whose representation is selected based on attributes of the retrieval request (a.k.a., content negotiation), then whatever is identified by the fragment should be consistent across all of those representations. Each representation should either define the fragment so that it corresponds to the same secondary resource, regardless of how it is represented, or should leave the fragment undefined (i.e., not found).

As with any URI, use of a fragment identifier component does not imply that a retrieval action will take place. A URI with a fragment identifier may be used to refer to the secondary resource without any implication that the primary resource is accessible or will ever be accessed.

Fragment identifiers have a special role in information retrieval systems as the primary form of client-side indirect referencing, allowing an author to specifically identify aspects of an existing resource that are only indirectly provided by the resource owner. As such, the fragment identifier is not used in the scheme-specific processing of a URI; instead, the fragment identifier is separated from the rest of the URI prior to a dereference, and thus the identifying information within the fragment itself is dereferenced solely by the user agent, regardless of the URI scheme. Although this separate handling is often perceived to be a loss of information, particularly for accurate redirection of references as resources move over time, it also serves to prevent information providers from denying reference authors the right to refer to information within a resource selectively. Indirect referencing also provides additional flexibility and extensibility to systems that use URIs, as new media types are easier to define and deploy than new schemes of identification.

The characters slash ("/") and question mark ("?") are allowed to represent data within the fragment identifier. Beware that some older, erroneous implementations may not handle this data correctly when it is used as the base URI for relative references (Section 5.1).

Usage

When applications make reference to a URI, they do not always use the full form of reference defined by the "URI" syntax rule. To save space and take advantage of hierarchical locality, many Internet protocol elements and media type formats allow an abbreviation of a URI, whereas others restrict the syntax to a particular form of URI. We define the most common forms of reference syntax in this specification because they impact and depend upon the design of the generic syntax, requiring a uniform parsing algorithm in order to be interpreted consistently.

URI Reference

URI-reference is used to denote the most common usage of a resource identifier.

   URI-reference = URI / relative-ref

A URI-reference is either a URI or a relative reference. If the URI-reference's prefix does not match the syntax of a scheme followed by its colon separator, then the URI-reference is a relative reference.

A URI-reference is typically parsed first into the five URI components, in order to determine what components are present and whether the reference is relative. Then, each component is parsed for its subparts and their validation. The ABNF of URI-reference, along with the "first-match-wins" disambiguation rule, is sufficient to define a validating parser for the generic syntax. Readers familiar with regular expressions should see Appendix B for an example of a non-validating URI-reference parser that will take any given string and extract the URI components.

Relative Reference

A relative reference takes advantage of the hierarchical syntax (Section 1.2.3) to express a URI reference relative to the name space of another hierarchical URI.

   relative-ref  = relative-part [ "?" query ] [ "#" fragment ]

relative-part = "//" authority path-abempty
/ path-absolute
/ path-noscheme
/ path-empty

The URI referred to by a relative reference, also known as the target URI, is obtained by applying the reference resolution algorithm of Section 5.

A relative reference that begins with two slash characters is termed a network-path reference; such references are rarely used. A relative reference that begins with a single slash character is termed an absolute-path reference. A relative reference that does not begin with a slash character is termed a relative-path reference.

A path segment that contains a colon character (e.g., "this:that") cannot be used as the first segment of a relative-path reference, as it would be mistaken for a scheme name. Such a segment must be preceded by a dot-segment (e.g., "./this:that") to make a relative-path reference.

Absolute URI

Some protocol elements allow only the absolute form of a URI without a fragment identifier. For example, defining a base URI for later use by relative references calls for an absolute-URI syntax rule that does not allow a fragment.

   absolute-URI  = scheme ":" hier-part [ "?" query ]

URI scheme specifications must define their own syntax so that all strings matching their scheme-specific syntax will also match the grammar. Scheme specifications will not define fragment identifier syntax or usage, regardless of its applicability to resources identifiable via that scheme, as fragment identification is orthogonal to scheme definition. However, scheme specifications are encouraged to include a wide range of examples, including examples that show use of the scheme's URIs with fragment identifiers when such usage is appropriate.

Same-Document Reference

When a URI reference refers to a URI that is, aside from its fragment component (if any), identical to the base URI (Section 5.1), that reference is called a "same-document" reference. The most frequent examples of same-document references are relative references that are empty or include only the number sign ("#") separator followed by a fragment identifier.

When a same-document reference is dereferenced for a retrieval action, the target of that reference is defined to be within the same entity (representation, document, or message) as the reference; therefore, a dereference should not result in a new retrieval action.

Normalization of the base and target URIs prior to their comparison, as described in Sections 6.2.2 and 6.2.3, is allowed but rarely performed in practice. Normalization may increase the set of same-document references, which may be of benefit to some caching applications. As such, reference authors should not assume that a slightly different, though equivalent, reference URI will (or will not) be interpreted as a same-document reference by any given application.

Suffix Reference

The URI syntax is designed for unambiguous reference to resources and extensibility via the URI scheme. However, as URI identification and usage have become commonplace, traditional media (television, radio, newspapers, billboards, etc.) have increasingly used a suffix of the URI as a reference, consisting of only the authority and path portions of the URI, such as

   www.w3.org/Addressing/

or simply a DNS registered name on its own. Such references are primarily intended for human interpretation rather than for machines, with the assumption that context-based heuristics are sufficient to complete the URI (e.g., most registered names beginning with "www" are likely to have a URI prefix of "http://"). Although there is no standard set of heuristics for disambiguating a URI suffix, many client implementations allow them to be entered by the user and heuristically resolved.

Although this practice of using suffix references is common, it should be avoided whenever possible and should never be used in situations where long-term references are expected. The heuristics noted above will change over time, particularly when a new URI scheme becomes popular, and are often incorrect when used out of context. Furthermore, they can lead to security issues along the lines of those described in [RFC1535].

As a URI suffix has the same syntax as a relative-path reference, a suffix reference cannot be used in contexts where a relative reference is expected. As a result, suffix references are limited to places where there is no defined base URI, such as dialog boxes and off-line advertisements.

Reference Resolution

This section defines the process of resolving a URI reference within a context that allows relative references so that the result is a string matching the syntax rule of Section 3.

Establishing a Base URI

The term "relative" implies that a "base URI" exists against which the relative reference is applied. Aside from fragment-only references (Section 4.4), relative references are only usable when a base URI is known. A base URI must be established by the parser prior to parsing URI references that might be relative. A base URI must conform to the syntax rule (Section 4.3). If the base URI is obtained from a URI reference, then that reference must be converted to absolute form and stripped of any fragment component prior to its use as a base URI.

The base URI of a reference can be established in one of four ways, discussed below in order of precedence. The order of precedence can be thought of in terms of layers, where the innermost defined base URI has the highest precedence. This can be visualized graphically as follows:

   .----------------------------------------------------------.
| .----------------------------------------------------. |
| | .----------------------------------------------. | |
| | | .----------------------------------------. | | |
| | | | .----------------------------------. | | | |
| | | | | | | | | |
| | | | `----------------------------------' | | | |
| | | | (5.1.1) Base URI embedded in content | | | |
| | | `----------------------------------------' | | |
| | | (5.1.2) Base URI of the encapsulating entity | | |
| | | (message, representation, or none) | | |
| | `----------------------------------------------' | |
| | (5.1.3) URI used to retrieve the entity | |
| `----------------------------------------------------' |
| (5.1.4) Default Base URI (application-dependent) |
`----------------------------------------------------------'

Base URI Embedded in Content

Within certain media types, a base URI for relative references can be embedded within the content itself so that it can be readily obtained by a parser. This can be useful for descriptive documents, such as tables of contents, which may be transmitted to others through protocols other than their usual retrieval context (e.g., email or USENET news).

It is beyond the scope of this specification to specify how, for each media type, a base URI can be embedded. The appropriate syntax, when available, is described by the data format specification associated with each media type.

Base URI from the Encapsulating Entity

If no base URI is embedded, the base URI is defined by the representation's retrieval context. For a document that is enclosed within another entity, such as a message or archive, the retrieval context is that entity. Thus, the default base URI of a representation is the base URI of the entity in which the representation is encapsulated.

A mechanism for embedding a base URI within MIME container types (e.g., the message and multipart types) is defined by MHTML [RFC2557]. Protocols that do not use the MIME message header syntax, but that do allow some form of tagged metadata to be included within messages, may define their own syntax for defining a base URI as part of a message.

Base URI from the Retrieval URI

If no base URI is embedded and the representation is not encapsulated within some other entity, then, if a URI was used to retrieve the representation, that URI shall be considered the base URI. Note that if the retrieval was the result of a redirected request, the last URI used (i.e., the URI that resulted in the actual retrieval of the representation) is the base URI.

Default Base URI

If none of the conditions described above apply, then the base URI is defined by the context of the application. As this definition is necessarily application-dependent, failing to define a base URI by using one of the other methods may result in the same content being interpreted differently by different types of applications.

A sender of a representation containing relative references is responsible for ensuring that a base URI for those references can be established. Aside from fragment-only references, relative references can only be used reliably in situations where the base URI is well defined.

Relative Resolution

This section describes an algorithm for converting a URI reference that might be relative to a given base URI into the parsed components of the reference's target. The components can then be recomposed, as described in Section 5.3, to form the target URI. This algorithm provides definitive results that can be used to test the output of other implementations. Applications may implement relative reference resolution by using some other algorithm, provided that the results match what would be given by this one.

Pre-parse the Base URI

The base URI (Base) is established according to the procedure of Section 5.1 and parsed into the five main components described in Section 3. Note that only the scheme component is required to be present in a base URI; the other components may be empty or undefined. A component is undefined if its associated delimiter does not appear in the URI reference; the path component is never undefined, though it may be empty.

Normalization of the base URI, as described in Sections 6.2.2 and 6.2.3, is optional. A URI reference must be transformed to its target URI before it can be normalized.

Transform References

For each URI reference (R), the following pseudocode describes an algorithm for transforming R into its target URI (T):

   -- The URI reference is parsed into the five URI components
--
(R.scheme, R.authority, R.path, R.query, R.fragment) = parse(R);

-- A non-strict parser may ignore a scheme in the reference
-- if it is identical to the base URI's scheme.
--
if ((not strict) and (R.scheme == Base.scheme)) then
undefine(R.scheme);
endif;

if defined(R.scheme) then
T.scheme = R.scheme;
T.authority = R.authority;
T.path = remove_dot_segments(R.path);
T.query = R.query;
else
if defined(R.authority) then
T.authority = R.authority;
T.path = remove_dot_segments(R.path);
T.query = R.query;
else
if (R.path == "") then
T.path = Base.path;
if defined(R.query) then
T.query = R.query;
else
T.query = Base.query;
endif;
else
if (R.path starts-with "/") then
T.path = remove_dot_segments(R.path);
else
T.path = merge(Base.path, R.path);
T.path = remove_dot_segments(T.path);
endif;
T.query = R.query;
endif;
T.authority = Base.authority;
endif;
T.scheme = Base.scheme;
endif;

T.fragment = R.fragment;

Merge Paths

The pseudocode above refers to a "merge" routine for merging a relative-path reference with the path of the base URI. This is accomplished as follows:

  • If the base URI has a defined authority component and an empty path, then return a string consisting of "/" concatenated with the reference's path; otherwise,
  • return a string consisting of the reference's path component appended to all but the last segment of the base URI's path (i.e., excluding any characters after the right-most "/" in the base URI path, or excluding the entire base URI path if it does not contain any "/" characters).

Remove Dot Segments

The pseudocode also refers to a "remove_dot_segments" routine for interpreting and removing the special "." and ".." complete path segments from a referenced path. This is done after the path is extracted from a reference, whether or not the path was relative, in order to remove any invalid or extraneous dot-segments prior to forming the target URI. Although there are many ways to accomplish this removal process, we describe a simple method using two string buffers.

  1. The input buffer is initialized with the now-appended path components and the output buffer is initialized to the empty string.
  2. While the input buffer is not empty, loop as follows:
    1. If the input buffer begins with a prefix of "../" or "./", then remove that prefix from the input buffer; otherwise,
    2. if the input buffer begins with a prefix of "/./" or "/.", where "." is a complete path segment, then replace that prefix with "/" in the input buffer; otherwise,
    3. if the input buffer begins with a prefix of "/../" or "/..", where ".." is a complete path segment, then replace that prefix with "/" in the input buffer and remove the last segment and its preceding "/" (if any) from the output buffer; otherwise,
    4. if the input buffer consists only of "." or "..", then remove that from the input buffer; otherwise,
    5. move the first path segment in the input buffer to the end of the output buffer, including the initial "/" character (if any) and any subsequent characters up to, but not including, the next "/" character or the end of the input buffer.
  3. Finally, the output buffer is returned as the result of remove_dot_segments.

Note that dot-segments are intended for use in URI references to express an identifier relative to the hierarchy of names in the base URI. The remove_dot_segments algorithm respects that hierarchy by removing extra dot-segments rather than treat them as an error or leaving them to be misinterpreted by dereference implementations.

The following illustrates how the above steps are applied for two examples of merged paths, showing the state of the two buffers after each step.

   STEP   OUTPUT BUFFER         INPUT BUFFER

1 : /a/b/c/./../../g
2E: /a /b/c/./../../g
2E: /a/b /c/./../../g
2E: /a/b/c /./../../g
2B: /a/b/c /../../g
2C: /a/b /../g
2C: /a /g
2E: /a/g

STEP OUTPUT BUFFER INPUT BUFFER

1 : mid/content=5/../6
2E: mid /content=5/../6
2E: mid/content=5 /../6
2C: mid /6
2E: mid/6

Some applications may find it more efficient to implement the remove_dot_segments algorithm by using two segment stacks rather than strings.

Note: Beware that some older, erroneous implementations will fail to separate a reference's query component from its path component prior to merging the base and reference paths, resulting in an interoperability failure if the query component contains the strings "/../" or "/./".

Component Recomposition

Parsed URI components can be recomposed to obtain the corresponding URI reference string. Using pseudocode, this would be:

   result = ""

if defined(scheme) then
append scheme to result;
append ":" to result;
endif;

if defined(authority) then
append "//" to result;
append authority to result;
endif;

append path to result;

if defined(query) then
append "?" to result;
append query to result;
endif;

if defined(fragment) then
append "#" to result;
append fragment to result;
endif;

return result;

Note that we are careful to preserve the distinction between a component that is undefined, meaning that its separator was not present in the reference, and a component that is empty, meaning that the separator was present and was immediately followed by the next component separator or the end of the reference.

Reference Resolution Examples

Within a representation with a well defined base URI of

   http://a/b/c/d;p?q

a relative reference is transformed to its target URI as follows.

Normal Examples

   "g:h"           =  "g:h"
"g" = "http://a/b/c/g"
"./g" = "http://a/b/c/g"
"g/" = "http://a/b/c/g/"
"/g" = "http://a/g"
"//g" = "http://g"
"?y" = "http://a/b/c/d;p?y"
"g?y" = "http://a/b/c/g?y"
"#s" = "http://a/b/c/d;p?q#s"
"g#s" = "http://a/b/c/g#s"
"g?y#s" = "http://a/b/c/g?y#s"
";x" = "http://a/b/c/;x"
"g;x" = "http://a/b/c/g;x"
"g;x?y#s" = "http://a/b/c/g;x?y#s"
"" = "http://a/b/c/d;p?q"
"." = "http://a/b/c/"
"./" = "http://a/b/c/"
".." = "http://a/b/"
"../" = "http://a/b/"
"../g" = "http://a/b/g"
"../.." = "http://a/"
"../../" = "http://a/"
"../../g" = "http://a/g"

Abnormal Examples

Although the following abnormal examples are unlikely to occur in normal practice, all URI parsers should be capable of resolving them consistently. Each example uses the same base as that above.

Parsers must be careful in handling cases where there are more ".." segments in a relative-path reference than there are hierarchical levels in the base URI's path. Note that the ".." syntax cannot be used to change the authority component of a URI.

   "../../../g"    =  "http://a/g"
"../../../../g" = "http://a/g"

Similarly, parsers must remove the dot-segments "." and ".." when they are complete components of a path, but not when they are only part of a segment.

   "/./g"          =  "http://a/g"
"/../g" = "http://a/g"
"g." = "http://a/b/c/g."
".g" = "http://a/b/c/.g"
"g.." = "http://a/b/c/g.."
"..g" = "http://a/b/c/..g"

Less likely are cases where the relative reference uses unnecessary or nonsensical forms of the "." and ".." complete path segments.

   "./../g"        =  "http://a/b/g"
"./g/." = "http://a/b/c/g/"
"g/./h" = "http://a/b/c/g/h"
"g/../h" = "http://a/b/c/h"
"g;x=1/./y" = "http://a/b/c/g;x=1/y"
"g;x=1/../y" = "http://a/b/c/y"

Some applications fail to separate the reference's query and/or fragment components from the path component before merging it with the base path and removing dot-segments. This error is rarely noticed, as typical usage of a fragment never includes the hierarchy ("/") character and the query component is not normally used within relative references.

   "g?y/./x"       =  "http://a/b/c/g?y/./x"
"g?y/../x" = "http://a/b/c/g?y/../x"
"g#s/./x" = "http://a/b/c/g#s/./x"
"g#s/../x" = "http://a/b/c/g#s/../x"

Some parsers allow the scheme name to be present in a relative reference if it is the same as the base URI scheme. This is considered to be a loophole in prior specifications of partial URI [RFC1630]. Its use should be avoided but is allowed for backward compatibility.

   "http:g"        =  "http:g"         ; for strict parsers
/ "http://a/b/c/g" ; for backward compatibility

Normalization and Comparison

One of the most common operations on URIs is simple comparison: determining whether two URIs are equivalent without using the URIs to access their respective resource(s). A comparison is performed every time a response cache is accessed, a browser checks its history to color a link, or an XML parser processes tags within a namespace. Extensive normalization prior to comparison of URIs is often used by spiders and indexing engines to prune a search space or to reduce duplication of request actions and response storage.

URI comparison is performed for some particular purpose. Protocols or implementations that compare URIs for different purposes will often be subject to differing design trade-offs in regards to how much effort should be spent in reducing aliased identifiers. This section describes various methods that may be used to compare URIs, the trade-offs between them, and the types of applications that might use them.

Equivalence

Because URIs exist to identify resources, presumably they should be considered equivalent when they identify the same resource. However, this definition of equivalence is not of much practical use, as there is no way for an implementation to compare two resources unless it has full knowledge or control of them. For this reason, determination of equivalence or difference of URIs is based on string comparison, perhaps augmented by reference to additional rules provided by URI scheme definitions. We use the terms "different" and "equivalent" to describe the possible outcomes of such comparisons, but there are many application-dependent versions of equivalence.

Even though it is possible to determine that two URIs are equivalent, URI comparison is not sufficient to determine whether two URIs identify different resources. For example, an owner of two different domain names could decide to serve the same resource from both, resulting in two different URIs. Therefore, comparison methods are designed to minimize false negatives while strictly avoiding false positives.

In testing for equivalence, applications should not directly compare relative references; the references should be converted to their respective target URIs before comparison. When URIs are compared to select (or avoid) a network action, such as retrieval of a representation, fragment components (if any) should be excluded from the comparison.

Comparison Ladder

A variety of methods are used in practice to test URI equivalence. These methods fall into a range, distinguished by the amount of processing required and the degree to which the probability of false negatives is reduced. As noted above, false negatives cannot be eliminated. In practice, their probability can be reduced, but this reduction requires more processing and is not cost-effective for all applications.

If this range of comparison practices is considered as a ladder, the following discussion will climb the ladder, starting with practices that are cheap but have a relatively higher chance of producing false negatives, and proceeding to those that have higher computational cost and lower risk of false negatives.

Simple String Comparison

If two URIs, when considered as character strings, are identical, then it is safe to conclude that they are equivalent. This type of equivalence test has very low computational cost and is in wide use in a variety of applications, particularly in the domain of parsing.

Testing strings for equivalence requires some basic precautions. This procedure is often referred to as "bit-for-bit" or "byte-for-byte" comparison, which is potentially misleading. Testing strings for equality is normally based on pair comparison of the characters that make up the strings, starting from the first and proceeding until both strings are exhausted and all characters are found to be equal, until a pair of characters compares unequal, or until one of the strings is exhausted before the other.

This character comparison requires that each pair of characters be put in comparable form. For example, should one URI be stored in a byte array in EBCDIC encoding and the second in a Java String object (UTF-16), bit-for-bit comparisons applied naively will produce errors. It is better to speak of equality on a character-for-character basis rather than on a byte-for-byte or bit-for-bit basis. In practical terms, character-by-character comparisons should be done codepoint-by-codepoint after conversion to a common character encoding.

False negatives are caused by the production and use of URI aliases. Unnecessary aliases can be reduced, regardless of the comparison method, by consistently providing URI references in an already-normalized form (i.e., a form identical to what would be produced after normalization is applied, as described below).

Protocols and data formats often limit some URI comparisons to simple string comparison, based on the theory that people and implementations will, in their own best interest, be consistent in providing URI references, or at least consistent enough to negate any efficiency that might be obtained from further normalization.

Syntax-Based Normalization

Implementations may use logic based on the definitions provided by this specification to reduce the probability of false negatives. This processing is moderately higher in cost than character-for-character string comparison. For example, an application using this approach could reasonably consider the following two URIs equivalent:

   example://a/b/c/%7Bfoo%7D
eXAMPLE://a/./b/../b/%63/%7bfoo%7d

Web user agents, such as browsers, typically apply this type of URI normalization when determining whether a cached response is available. Syntax-based normalization includes such techniques as case normalization, percent-encoding normalization, and removal of dot-segments.

Case Normalization

For all URIs, the hexadecimal digits within a percent-encoding triplet (e.g., "%3a" versus "%3A") are case-insensitive and therefore should be normalized to use uppercase letters for the digits A-F.

When a URI uses components of the generic syntax, the component syntax equivalence rules always apply; namely, that the scheme and host are case-insensitive and therefore should be normalized to lowercase. For example, the URI is equivalent to . The other generic syntax components are assumed to be case-sensitive unless specifically defined otherwise by the scheme (see Section 6.2.3).

Percent-Encoding Normalization

The percent-encoding mechanism (Section 2.1) is a frequent source of variance among otherwise identical URIs. In addition to the case normalization issue noted above, some URI producers percent-encode octets that do not require percent-encoding, resulting in URIs that are equivalent to their non-encoded counterparts. These URIs should be normalized by decoding any percent-encoded octet that corresponds to an unreserved character, as described in Section 2.3.

Path Segment Normalization

The complete path segments "." and ".." are intended only for use within relative references (Section 4.1) and are removed as part of the reference resolution process (Section 5.2). However, some deployed implementations incorrectly assume that reference resolution is not necessary when the reference is already a URI and thus fail to remove dot-segments when they occur in non-relative paths. URI normalizers should remove dot-segments by applying the remove_dot_segments algorithm to the path, as described in Section 5.2.4.

Scheme-Based Normalization

The syntax and semantics of URIs vary from scheme to scheme, as described by the defining specification for each scheme. Implementations may use scheme-specific rules, at further processing cost, to reduce the probability of false negatives. For example, because the "http" scheme makes use of an authority component, has a default port of "80", and defines an empty path to be equivalent to "/", the following four URIs are equivalent:

   http://example.com
http://example.com/
http://example.com:/
http://example.com:80/

In general, a URI that uses the generic syntax for authority with an empty path should be normalized to a path of "/". Likewise, an explicit ":port", for which the port is empty or the default for the scheme, is equivalent to one where the port and its ":" delimiter are elided and thus should be removed by scheme-based normalization. For example, the second URI above is the normal form for the "http" scheme.

Another case where normalization varies by scheme is in the handling of an empty authority component or empty host subcomponent. For many scheme specifications, an empty authority or host is considered an error; for others, it is considered equivalent to "localhost" or the end-user's host. When a scheme defines a default for authority and a URI reference to that default is desired, the reference should be normalized to an empty authority for the sake of uniformity, brevity, and internationalization. If, however, either the userinfo or port subcomponents are non-empty, then the host should be given explicitly even if it matches the default.

Normalization should not remove delimiters when their associated component is empty unless licensed to do so by the scheme specification. For example, the URI "http://example.com/?" cannot be assumed to be equivalent to any of the examples above. Likewise, the presence or absence of delimiters within a userinfo subcomponent is usually significant to its interpretation. The fragment component is not subject to any scheme-based normalization; thus, two URIs that differ only by the suffix "#" are considered different regardless of the scheme.

Some schemes define additional subcomponents that consist of case-insensitive data, giving an implicit license to normalizers to convert this data to a common case (e.g., all lowercase). For example, URI schemes that define a subcomponent of path to contain an Internet hostname, such as the "mailto" URI scheme, cause that subcomponent to be case-insensitive and thus subject to case normalization (e.g., "mailto:Joe@Example.COM" is equivalent to "mailto:Joe@example.com", even though the generic syntax considers the path component to be case-sensitive).

Other scheme-specific normalizations are possible.

Protocol-Based Normalization

Substantial effort to reduce the incidence of false negatives is often cost-effective for web spiders. Therefore, they implement even more aggressive techniques in URI comparison. For example, if they observe that a URI such as

   http://example.com/data

redirects to a URI differing only in the trailing slash

   http://example.com/data/

they will likely regard the two as equivalent in the future. This kind of technique is only appropriate when equivalence is clearly indicated by both the result of accessing the resources and the common conventions of their scheme's dereference algorithm (in this case, use of redirection by HTTP origin servers to avoid problems with relative references).

Security Considerations

A URI does not in itself pose a security threat. However, as URIs are often used to provide a compact set of instructions for access to network resources, care must be taken to properly interpret the data within a URI, to prevent that data from causing unintended access, and to avoid including data that should not be revealed in plain text.

Reliability and Consistency

There is no guarantee that once a URI has been used to retrieve information, the same information will be retrievable by that URI in the future. Nor is there any guarantee that the information retrievable via that URI in the future will be observably similar to that retrieved in the past. The URI syntax does not constrain how a given scheme or authority apportions its namespace or maintains it over time. Such guarantees can only be obtained from the person(s) controlling that namespace and the resource in question. A specific URI scheme may define additional semantics, such as name persistence, if those semantics are required of all naming authorities for that scheme.

Malicious Construction

It is sometimes possible to construct a URI so that an attempt to perform a seemingly harmless, idempotent operation, such as the retrieval of a representation, will in fact cause a possibly damaging remote operation. The unsafe URI is typically constructed by specifying a port number other than that reserved for the network protocol in question. The client unwittingly contacts a site running a different protocol service, and data within the URI contains instructions that, when interpreted according to this other protocol, cause an unexpected operation. A frequent example of such abuse has been the use of a protocol-based scheme with a port component of "25", thereby fooling user agent software into sending an unintended or impersonating message via an SMTP server.

Applications should prevent dereference of a URI that specifies a TCP port number within the "well-known port" range (0 - 1023) unless the protocol being used to dereference that URI is compatible with the protocol expected on that well-known port. Although IANA maintains a registry of well-known ports, applications should make such restrictions user-configurable to avoid preventing the deployment of new services.

When a URI contains percent-encoded octets that match the delimiters for a given resolution or dereference protocol (for example, CR and LF characters for the TELNET protocol), these percent-encodings must not be decoded before transmission across that protocol. Transfer of the percent-encoding, which might violate the protocol, is less harmful than allowing decoded octets to be interpreted as additional operations or parameters, perhaps triggering an unexpected and possibly harmful remote operation.

Back-End Transcoding

When a URI is dereferenced, the data within it is often parsed by both the user agent and one or more servers. In HTTP, for example, a typical user agent will parse a URI into its five major components, access the authority's server, and send it the data within the authority, path, and query components. A typical server will take that information, parse the path into segments and the query into key/value pairs, and then invoke implementation-specific handlers to respond to the request. As a result, a common security concern for server implementations that handle a URI, either as a whole or split into separate components, is proper interpretation of the octet data represented by the characters and percent-encodings within that URI.

Percent-encoded octets must be decoded at some point during the dereference process. Applications must split the URI into its components and subcomponents prior to decoding the octets, as otherwise the decoded octets might be mistaken for delimiters. Security checks of the data within a URI should be applied after decoding the octets. Note, however, that the "" percent-encoding (NUL) may require special handling and should be rejected if the application is not expecting to receive raw data within a component.

Special care should be taken when the URI path interpretation process involves the use of a back-end file system or related system functions. File systems typically assign an operational meaning to special characters, such as the "/", "\", ":", "[", and "]" characters, and to special device names like ".", "..", "...", "aux", "lpt", etc. In some cases, merely testing for the existence of such a name will cause the operating system to pause or invoke unrelated system calls, leading to significant security concerns regarding denial of service and unintended data transfer. It would be impossible for this specification to list all such significant characters and device names. Implementers should research the reserved names and characters for the types of storage device that may be attached to their applications and restrict the use of data obtained from URI components accordingly.

Rare IP Address Formats

Although the URI syntax for IPv4address only allows the common dotted-decimal form of IPv4 address literal, many implementations that process URIs make use of platform-dependent system routines, such as gethostbyname() and inet_aton(), to translate the string literal to an actual IP address. Unfortunately, such system routines often allow and process a much larger set of formats than those described in Section 3.2.2.

For example, many implementations allow dotted forms of three numbers, wherein the last part is interpreted as a 16-bit quantity and placed in the right-most two bytes of the network address (e.g., a Class B network). Likewise, a dotted form of two numbers means that the last part is interpreted as a 24-bit quantity and placed in the right-most three bytes of the network address (Class A), and a single number (without dots) is interpreted as a 32-bit quantity and stored directly in the network address. Adding further to the confusion, some implementations allow each dotted part to be interpreted as decimal, octal, or hexadecimal, as specified in the C language (i.e., a leading 0x or 0X implies hexadecimal; a leading 0 implies octal; otherwise, the number is interpreted as decimal).

These additional IP address formats are not allowed in the URI syntax due to differences between platform implementations. However, they can become a security concern if an application attempts to filter access to resources based on the IP address in string literal format. If this filtering is performed, literals should be converted to numeric form and filtered based on the numeric value, and not on a prefix or suffix of the string form.

Sensitive Information

URI producers should not provide a URI that contains a username or password that is intended to be secret. URIs are frequently displayed by browsers, stored in clear text bookmarks, and logged by user agent history and intermediary applications (proxies). A password appearing within the userinfo component is deprecated and should be considered an error (or simply ignored) except in those rare cases where the 'password' parameter is intended to be public.

Semantic Attacks

Because the userinfo subcomponent is rarely used and appears before the host in the authority component, it can be used to construct a URI intended to mislead a human user by appearing to identify one (trusted) naming authority while actually identifying a different authority hidden behind the noise. For example

   ftp://cnn.example.com&story=breaking_news@10.0.0.1/top_story.htm

might lead a human user to assume that the host is 'cnn.example.com', whereas it is actually '10.0.0.1'. Note that a misleading userinfo subcomponent could be much longer than the example above.

A misleading URI, such as that above, is an attack on the user's preconceived notions about the meaning of a URI rather than an attack on the software itself. User agents may be able to reduce the impact of such attacks by distinguishing the various components of the URI when they are rendered, such as by using a different color or tone to render userinfo if any is present, though there is no panacea. More information on URI-based semantic attacks can be found in [Siedzik].

Collected ABNF for URI

 URI           = scheme ":" hier-part [ "?" query ] [ "#" fragment ]

hier-part = "//" authority path-abempty
/ path-absolute
/ path-rootless
/ path-empty

URI-reference = URI / relative-ref

absolute-URI = scheme ":" hier-part [ "?" query ]

relative-ref = relative-part [ "?" query ] [ "#" fragment ]

relative-part = "//" authority path-abempty
/ path-absolute
/ path-noscheme
/ path-empty

scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )

authority = [ userinfo "@" ] host [ ":" port ]
userinfo = *( unreserved / pct-encoded / sub-delims / ":" )
host = IP-literal / IPv4address / reg-name
port = *DIGIT

IP-literal = "[" ( IPv6address / IPvFuture ) "]"

IPvFuture = "v" 1*HEXDIG "." 1*( unreserved / sub-delims / ":" )

IPv6address = 6( h16 ":" ) ls32
/ "::" 5( h16 ":" ) ls32
/ [ h16 ] "::" 4( h16 ":" ) ls32
/ [ *1( h16 ":" ) h16 ] "::" 3( h16 ":" ) ls32
/ [ *2( h16 ":" ) h16 ] "::" 2( h16 ":" ) ls32
/ [ *3( h16 ":" ) h16 ] "::" h16 ":" ls32
/ [ *4( h16 ":" ) h16 ] "::" ls32
/ [ *5( h16 ":" ) h16 ] "::" h16
/ [ *6( h16 ":" ) h16 ] "::"

h16 = 1*4HEXDIG
ls32 = ( h16 ":" h16 ) / IPv4address

IPv4address = dec-octet "." dec-octet "." dec-octet "." dec-octet

dec-octet = DIGIT ; 0-9
/ %x31-39 DIGIT ; 10-99
/ "1" 2DIGIT ; 100-199
/ "2" %x30-34 DIGIT ; 200-249
/ "25" %x30-35 ; 250-255

reg-name = *( unreserved / pct-encoded / sub-delims )

path = path-abempty ; begins with "/" or is empty
/ path-absolute ; begins with "/" but not "//"
/ path-noscheme ; begins with a non-colon segment
/ path-rootless ; begins with a segment
/ path-empty ; zero characters

path-abempty = *( "/" segment )
path-absolute = "/" [ segment-nz *( "/" segment ) ]
path-noscheme = segment-nz-nc *( "/" segment )
path-rootless = segment-nz *( "/" segment )
path-empty = 0

segment = *pchar
segment-nz = 1*pchar
segment-nz-nc = 1*( unreserved / pct-encoded / sub-delims / "@" )
; non-zero-length segment without any colon ":"

pchar = unreserved / pct-encoded / sub-delims / ":" / "@"

query = *( pchar / "/" / "?" )

fragment = *( pchar / "/" / "?" )

pct-encoded = "%" HEXDIG HEXDIG

unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
reserved = gen-delims / sub-delims
gen-delims = ":" / "/" / "?" / "#" / "[" / "]" / "@"
sub-delims = "!" / "$" / "&" / "'" / "(" / ")"
/ "*" / "+" / "," / ";" / "="

Parsing a URI Reference with a Regular Expression

As the "first-match-wins" algorithm is identical to the "greedy" disambiguation method used by POSIX regular expressions, it is natural and commonplace to use a regular expression for parsing the potential five components of a URI reference.

The following line is the regular expression for breaking-down a well-formed URI reference into its components.

   ^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?
12 3 4 5 6 7 8 9

The numbers in the second line above are only to assist readability; they indicate the reference points for each subexpression (i.e., each paired parenthesis). We refer to the value matched for subexpression as $. For example, matching the above expression to

   http://www.ics.uci.edu/pub/ietf/uri/#Related

results in the following subexpression matches:

   $1 = http:
$2 = http
$3 = //www.ics.uci.edu
$4 = www.ics.uci.edu
$5 = /pub/ietf/uri/
$6 =
$7 =
$8 = #Related
$9 = Related

where indicates that the component is not present, as is the case for the query component in the above example. Therefore, we can determine the value of the five components as

   scheme    = $2
authority = $4
path = $5
query = $7
fragment = $9

Going in the opposite direction, we can recreate a URI reference from its components by using the algorithm of Section 5.3.

Delimiting a URI in Context

URIs are often transmitted through formats that do not provide a clear context for their interpretation. For example, there are many occasions when a URI is included in plain text; examples include text sent in email, USENET news, and on printed paper. In such cases, it is important to be able to delimit the URI from the rest of the text, and in particular from punctuation marks that might be mistaken for part of the URI.

In practice, URIs are delimited in a variety of ways, but usually within double-quotes "http://example.com/", angle brackets , or just by using whitespace:

   http://example.com/

These wrappers do not form part of the URI.

In some cases, extra whitespace (spaces, line-breaks, tabs, etc.) may have to be added to break a long URI across lines. The whitespace should be ignored when the URI is extracted.

No whitespace should be introduced after a hyphen ("-") character. Because some typesetters and printers may (erroneously) introduce a hyphen at the end of line when breaking it, the interpreter of a URI containing a line break immediately after a hyphen should ignore all whitespace around the line break and should be aware that the hyphen may or may not actually be part of the URI.

Using <> angle brackets around each URI is especially recommended as a delimiting style for a reference that contains embedded whitespace.

The prefix "URL:" (with or without a trailing space) was formerly recommended as a way to help distinguish a URI from other bracketed designators, though it is not commonly used in practice and is no longer recommended.

For robustness, software that accepts user-typed URI should attempt to recognize and strip both delimiters and embedded whitespace.

For example, the text

   Yes, Jim, I found it under "http://www.w3.org/Addressing/",
but you can probably pick it up from . Note the warning in .

contains the URI references

   http://www.w3.org/Addressing/
ftp://foo.example.com/rfc/
http://www.ics.uci.edu/pub/ietf/uri/historical.html#WARNING

Changes from RFC 2396

Additions

An ABNF rule for URI has been introduced to correspond to one common usage of the term: an absolute URI with optional fragment.

IPv6 (and later) literals have been added to the list of possible identifiers for the host portion of an authority component, as described by [RFC2732], with the addition of "[" and "]" to the reserved set and a version flag to anticipate future versions of IP literals. Square brackets are now specified as reserved within the authority component and are not allowed outside their use as delimiters for an IP literal within host. In order to make this change without changing the technical definition of the path, query, and fragment components, those rules were redefined to directly specify the characters allowed.

As [RFC2732] defers to [RFC3513] for definition of an IPv6 literal address, which, unfortunately, lacks an ABNF description of IPv6address, we created a new ABNF rule for IPv6address that matches the text representations defined by Section 2.2 of [RFC3513]. Likewise, the definition of IPv4address has been improved in order to limit each decimal octet to the range 0-255.

Section 6, on URI normalization and comparison, has been completely rewritten and extended by using input from Tim Bray and discussion within the W3C Technical Architecture Group.

Modifications

The ad-hoc BNF syntax of RFC 2396 has been replaced with the ABNF of [RFC2234]. This change required all rule names that formerly included underscore characters to be renamed with a dash instead. In addition, a number of syntax rules have been eliminated or simplified to make the overall grammar more comprehensible. Specifications that refer to the obsolete grammar rules may be understood by replacing those rules according to the following table:

obsolete ruletranslation
absoluteURI absolute-URI
relativeURI relative-part [ "?" query ]
hier_part ( "//" authority path-abempty / path-absolute ) [ "?" query ]
opaque_part path-rootless [ "?" query ]
net_path "//" authority path-abempty
abs_path path-absolute
rel_path path-rootless
rel_segment segment-nz-nc
reg_name reg-name
server authority
hostport host [ ":" port ]
hostname reg-name
path_segments path-abempty
param *
uric unreserved / pct-encoded / ";" / "?" / ":" / "@" / "&" / "=" / "+" / "$" / "," / "/"
uric_no_slash unreserved / pct-encoded / ";" / "?" / ":" / "@" / "&" / "=" / "+" / "$" / ","
mark "-" / "_" / "." / "!" / "~" / "*" / "'" / "(" / ")"
escaped pct-encoded
hex HEXDIG
alphanum ALPHA / DIGIT

Use of the above obsolete rules for the definition of scheme-specific syntax is deprecated.

Section 2, on characters, has been rewritten to explain what characters are reserved, when they are reserved, and why they are reserved, even when they are not used as delimiters by the generic syntax. The mark characters that are typically unsafe to decode, including the exclamation mark ("!"), asterisk ("*"), single-quote ("'"), and open and close parentheses ("(" and ")"), have been moved to the reserved set in order to clarify the distinction between reserved and unreserved and, hopefully, to answer the most common question of scheme designers. Likewise, the section on percent-encoded characters has been rewritten, and URI normalizers are now given license to decode any percent-encoded octets corresponding to unreserved characters. In general, the terms "escaped" and "unescaped" have been replaced with "percent-encoded" and "decoded", respectively, to reduce confusion with other forms of escape mechanisms.

The ABNF for URI and URI-reference has been redesigned to make them more friendly to LALR parsers and to reduce complexity. As a result, the layout form of syntax description has been removed, along with the uric, uric_no_slash, opaque_part, net_path, abs_path, rel_path, path_segments, rel_segment, and mark rules. All references to "opaque" URIs have been replaced with a better description of how the path component may be opaque to hierarchy. The relativeURI rule has been replaced with relative-ref to avoid unnecessary confusion over whether they are a subset of URI. The ambiguity regarding the parsing of URI-reference as a URI or a relative-ref with a colon in the first segment has been eliminated through the use of five separate path matching rules.

The fragment identifier has been moved back into the section on generic syntax components and within the URI and relative-ref rules, though it remains excluded from absolute-URI. The number sign ("#") character has been moved back to the reserved set as a result of reintegrating the fragment syntax.

The ABNF has been corrected to allow the path component to be empty. This also allows an absolute-URI to consist of nothing after the "scheme:", as is present in practice with the "dav:" namespace [RFC2518] and with the "about:" scheme used internally by many WWW browser implementations. The ambiguity regarding the boundary between authority and path has been eliminated through the use of five separate path matching rules.

Registry-based naming authorities that use the generic syntax are now defined within the host rule. This change allows current implementations, where whatever name provided is simply fed to the local name resolution mechanism, to be consistent with the specification. It also removes the need to re-specify DNS name formats here. Furthermore, it allows the host component to contain percent-encoded octets, which is necessary to enable internationalized domain names to be provided in URIs, processed in their native character encodings at the application layers above URI processing, and passed to an IDNA library as a registered name in the UTF-8 character encoding. The server, hostport, hostname, domainlabel, toplabel, and alphanum rules have been removed.

Uniform Resource Identifier

By Shaikh Parvez

A URI can be classified as a locator or a name or both. A Uniform Resource Locator (URL) is a URI that, in addition to identifying a resource, provides means of acting upon or obtaining a representation of the resource by describing its primary access mechanism or network "location". For example, the URL http://www.wikipedia.org/ is a URI that identifies a resource (Wikipedia's home page) and implies that a representation of that resource (such as the home page's current HTML code, as encoded characters) is obtainable via HTTP from a network host named www.wikipedia.org. A Uniform Resource Name (URN) is a URI that identifies a resource by name in a particular namespace. A URN can be used to talk about a resource without implying its location or how to dereference it. For example, the URN urn:isbn:0-395-36341-1 is a URI that, like an International Standard Book Number (ISBN), allows one to talk about a book, but doesn't suggest where and how to obtain an actual copy of it.

In technical publications, especially standards produced by the IETF and the W3C, the term URL has long been deprecated, as it is rarely necessary to distinguish between URLs and URIs. However, in nontechnical contexts and in software for the World Wide Web, the term URL remains ubiquitous. Additionally, the term web address, which has no formal definition, is often used in nontechnical publications as a synonym for URL or URI, although it generally refers only to 'http' and 'https' URIs.

[edit] Syntax

The URI syntax is essentially a URI scheme name like "HTTP", "FTP", "mailto", "urn", "tel", "rtsp", etc., followed by a colon character, and then a scheme-specific part. The syntax and semantics of the scheme-specific part are determined by the specifications that govern the schemes, although the URI syntax does force all schemes to adhere to a certain generic syntax that, among other things, reserves certain characters for special purposes, without always saying what those purposes are. The URI syntax also enforces restrictions on the scheme-specific part, in order to, for example, provide for a degree of consistency when the part has a hierarchical structure. Percent-encoding is an often misunderstood aspect of URI syntax.

See also URI generic syntax

[edit] History

[edit] Naming, addressing, and identifying resources

URIs and URLs have a shared history. The idea of a URL — a short string representing a resource that is the target of a hyperlink — was implicitly introduced in early 1990 in Tim Berners-Lee's proposals for HyperText [1]. At the time, it was called a hypertext name or document name[2]

Over the next three-and-a-half years, as the World Wide Web's core technologies of HTML (the HyperText Markup Language), HTTP, and Web browsers were developed, a need to distinguish between strings that provide an address for resources and those that merely name resources emerged. Although not yet formally defined, the term Uniform Resource Locator came to represent strings that provide an address for resources, and the more contentious Uniform Resource Name came to represent strings that name resources.

During the debate over how to best define URLs and URNs, it became evident that the two concepts embodied by the terms were merely aspects of the fundamental, overarching notion of resource identification. So, in June 1994, the IETF published Berners-Lee's RFC 1630: the first RFC that (in its non-normative text) acknowledged the existence of URLs and URNs, and, more importantly, defined a formal syntax for Universal Resource Identifiers — URL-like strings whose precise syntax and semantics were dependent upon their scheme. In addition, this RFC attempted to summarize the syntax of URL schemes that were in use at the time. It also acknowledged, but did not standardize, the existence of relative URLs and fragment identifiers.

[edit] Refinement of specifications

In December 1994, RFC 1738 was published in order to formally define relative and absolute URLs, refine the general URL syntax, define how relative URLs were to be resolved to absolute form, and better enumerate the URL schemes that were in use at the time. The definition and syntax of URNs was not settled upon until the publication of RFC 2141 in May 1997.

With the publication of RFC 2396 in 1998, the URI syntax became a separate specification, and most parts of RFCs 1630 and 1738 became obsolete. In the new RFC, the "U" in "URI" was changed to represent "Uniform" rather than "Universal", and all parts of RFCs 1630 and 1738 relating to URIs and URLs in general were revised and expanded. Only those portions of RFC 1738 that summarized existing URL schemes were not rendered obsolete by RFC 2396.

In December 1999, RFC 2732 provided a minor update to RFC 2396, allowing URIs to accommodate IPv6 addresses. Some time later, a number of shortcomings discovered in the two specifications led to the development of a number of draft revisions under the title rfc2396bis. This community effort, coordinated by RFC 2396 co-author Roy Fielding, culminated in the publication of RFC 3986 in January 2005. This RFC is the current version of the URI syntax recommended for use on the Internet, and it renders RFC 2396 obsolete. It does not, however, render the details of existing URL schemes obsolete; those are still governed by RFC 1738, except where otherwise superseded — RFC 2616 for example, refines the "http" scheme. The content of RFC 3986 was simultaneously published by the IETF as the full standard STD 66, reflecting the establishment of the URI generic syntax as an official Internet protocol.

In August 2002, RFC 3305 pointed out that the term URL has, despite its ubiquity in the vernacular of the Internet-aware public at large, faded into near-obsolescence. It now serves only as a reminder that some URIs act as addresses because they have schemes that imply some kind of network accessibility, regardless of whether they are actually being used for that purpose. As URI-based standards such as Resource Description Framework make evident, resource identification need not be coupled with the retrieval of resource representations over the Internet, nor does it need to be associated with network-bound resources at all.

[edit] URI reference

A URI reference is another type of string that represents a URI, and, in turn, the resource identified by that URI. The distinction between a URI and a URI reference is not often maintained in informal usage, but protocol documents should not allow for ambiguity.

A URI reference may take the form of a full URI, or just the scheme-specific portion of one, or even some trailing component thereof—even the empty string. An optional fragment identifier, preceded by "#", may be present at the end of a URI reference. The part of the reference before the "#" indirectly identifies a resource, and the fragment identifier identifies some portion of that resource.

In order to derive a URI from a URI reference, the URI reference is converted to "absolute" form by merging it with an absolute "base" URI, according to a fixed algorithm. The URI reference is considered to be relative to the base URI, although if the reference itself is absolute, then the base is irrelevant. The base URI is typically the URI that identifies the document containing the URI reference, although this can be overridden by declarations made within the document or as part of an external data transmission protocol. If a fragment identifier is present in the base URI, it is ignored during the merging process. If a fragment identifier is present in the URI reference, it is preserved during the merging process.

In web document markup languages, URI references are frequently used in places where there is a need to point to other resources, such as external documents or specific portions of the same logical document.

[edit] Uses of URI references in markup languages

  • In HTML, the value of the src attribute of the img element is a URI reference, as is the value of the href attribute of the a or link element.
  • In XML, the system identifier appearing after the SYSTEM keyword in a DTD is a fragmentless URI reference;
  • In XSLT, the value of the href attribute of the xsl:import element/instruction is a URI reference, as is the first argument to the document() function.

[edit] Examples of absolute URIs

  • http://somehost/absolute/URI/with/absolute/path/to/resource.txt
  • ftp://somehost/resource.txt
  • urn:issn:1535-3613

[edit] Examples of URI references

  • http://example/resource.txt#frag01
  • http://somehost/absolute/URI/with/absolute/path/to/resource.txt
  • /relative/URI/with/absolute/path/to/resource.txt
  • relative/path/to/resource.txt
  • ../../../resource.txt
  • resource.txt
  • /resource.txt#frag01
  • #frag01
  • (empty string)

[edit] URI resolution

To "resolve" a URI means either to convert a relative URI reference to absolute form, or to dereference a URI or URI reference by attempting to obtain a representation of the resource that it identifies. The "resolver" component in document processing software generally provides both services.

A URI reference may be considered to be a same-document reference: a reference to the document containing the URI reference itself. Document processing software is encouraged to use its current representation of the document to satisfy the resolution of a same-document reference; a new representation should not be fetched. This is only a recommendation, and document processing software is free to use other mechanisms to determine whether obtaining a new representation is warranted.

According to the current URI specification, RFC 3986, a URI reference is a same-document reference if, when resolved to absolute form, it is identical to the base URI that is in effect for the reference. Typically, the base URI is the URI of the document containing the reference. XSLT 1.0, for example, has a document() function that, in effect, implements this functionality. RFC 3986 also formally defines URI equivalence, which can be used in order to determine that a URI reference, while not identical to the base URI, still represents the same resource and thus can be considered to be a same-document reference.

Same-document references were determined differently according to RFC 2396, which was made obsolete by RFC 3986 but is still used as the basis of many specifications and implementations. According to this specification, a URI reference is a same-document reference if it is an empty string or consists of only the "#" character followed by an optional fragment.

[edit] Examples of relative URIs

  • /relative/URI/with/absolute/path/to/resource.txt
  • relative/path/to/resource.txt
  • ../../../resource.txt
  • resource.txt

[edit] Relation to XML namespaces

XML has a concept of a namespace, an abstract domain to which a collection of element and attribute names can be assigned. An XML namespace is identified by a character string, the namespace name, which must adhere to the generic URI syntax. However, the namespace name is not considered to be a URI because the "URI-ness" of strings is, according to the URI specification, based on how they are intended to be used, not just their lexical components. A namespace name also does not necessarily imply any of the semantics of URI schemes; a namespace name beginning with "http:", for example, likely has nothing to do with the HTTP protocol. There has been much debate about this among XML professionals on the xml-dev electronic mailing list; some feel that a namespace name could be a URI, since the collection of names comprising a particular namespace could be considered to be a resource that is being identified, and since the Namespaces in XML specification says that the namespace name is a URI reference. The consensus seems to be, though, that a namespace name is just a string that happens to look like a URI, nothing more.

Initially, the namespace name was allowed to match the syntax of any non-empty URI reference, but the use of relative URI references was later deprecated by an erratum to the Namespaces In XML Recommendation. A separate specification was issued for namespaces for XML 1.1, and allows IRI references, not just URI references, to be used as the basis for namespace names.

In order to mitigate the confusion that began to arise among newcomers to XML from the use of URIs (particularly HTTP URLs) for namespaces, a descriptive language called RDDL was developed. An RDDL document can provide machine- and human-readable information about a particular namespace and about the XML documents that use it. XML document authors were encouraged to put RDDL documents in locations such that if a namespace name in their document was somehow dereferenced, then an RDDL document would be obtained, thus satisfying the desire among many developers for a namespace name to point to a network-accessible resource.

[edit] See also

For help on using external links on Wikipedia, see Help:URL and Wikipedia:External links

Wrapping up 301 redirection

hope that by now you understand a lot more about redirection on the internet. It is a hidden aspect, but one that is very important for search engine optimization and good website ranking.

We learned why we need correct redirection and how we can implement that. We learned about PHP, about mod_rewrite, and we learned that some nice hosting companies allow us to keep our hands clean and do it automatically for us.

Of course, if you have any suggestions to make this tutorial better, please drop me an email. If you are still lost, I strongly recommend that you visit the Cre8asite forums for help.

Apache mod_rewrite and 301 redirection

One of the most powerful Apache modules is the mod_rewrite, which allows you to 'rewrite' URLs. By rewriting a URL, you can completely control its new destination. Another bonus of using mod_rewrite is that since it works at the server level, it can be used to forward whole websites.

To use mod_rewrite, your server needs to support it. To find out, either use the PHP phpinfo() function or ask your hosting provider. Assuming you have mod_rewrite available, add the following code to your .htaccess file (more on that in a bit).

To forward mysite.com to www.mysite.com, use the following code:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^mysite\.com [nc]
RewriteRule (.*) http://www.mysite.com/$1 [R=301,L]

To forward www.mysite.com to mysite.com, use the following code:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.mysite\.com [nc]
RewriteRule (.*) http://mysite.com/$1 [R=301,L]

The .htaccess file

The Apache webserver uses .htaccess files to tweak its configuration while the server is running. The .htaccess file is a very versatile tool, but misusing it can make your site malfunction, so be careful!

The placement of the .htaccess file limits it effects: if you put it in your document root, it affects all of your website, but if you put it in a subdirectory, it affects that subdirectory and everything in it.

The .htaccess file is a simple text file, so edit it using a simple good text editor. For recommendations, see the list of freeware I keep.

More tips about .htaccess in this SEOChat forum thread and this thread.

301 redirection with PHP

Using the PHP header function, it is possible to do 301 redirection.

To forward www.mywebsite.com to mywebsite.com, use the following code:

if(stristr($_SERVER["HTTP_HOST"], 'www')){
header("HTTP/1.1 301 Moved Permanently");
header("Location: http://mywebsite.com/" . $_SERVER["REQUEST_URI"]);
exit();
}
?>

To forward mywebsite.com to www.mywebsite.com, use the following code:

if(!stristr($_SERVER["HTTP_HOST"], 'www')){
header("HTTP/1.1 301 Moved Permanently");
header("Location: http://www.mywebsite.com/" . $_SERVER["REQUEST_URI"]);
exit();
}
?>

Remember to replace 'mywebsite.com' with your correct website domain name :)

Some things worthy of notice:

  • Notice how we send the HTTP 301 header and then we immediately follow it with the new location.
  • Also, notice that we forward the REQUEST_URI value. The REQUEST_URI is the path within the website to the web page. For example, in http://ekstreme.com/phpcounter/index.php, the /phpcounter/index.php part is the REQUEST_URI. Our forwarding code above forwards to the user to the page they requested.
  • Notice the exit() statement: this makes sure that the PHP code following this code does not get executed and that only the forwarding information is sent to the browser.

This code is best used for single pages that require forwarding, and not whole websites. To use it, just add the code at the very beginning of the page's PHP file. Make sure there are no spaces or any other characters before the opening , otherwise, the code won't work and you'll get a warning.

Redirects using HTTP 301 headers

The correct way to forward your domain name in this context is to use what is known as the HTTP 301 redirection header. The what? Let me explain...

The HTTP protocol defines a set of headers that allow the internet to function. HTTP headers are usually not seen by website visitors, but are part of the communication between the web server and the browser. They are called headers because they are exchanged before the web server sends the HTML page (or any other file) to the browser; that is, they appear at the head - beginning - of the HTML document.

A subset of the standard HTTP headers deal with redirection; these are called the 3xx headers (because they are numbered 300, 301, 302, and so on). The HTTP 301 header means that the web page has moved permanently, and it is always followed by another header defining the new location of the web page.

To everyone using the website now, including search engines, this means that the web page or domain name should no longer be used. Instead the new location should be used. Thus when a search engine comes across a forwarding, it automatically indexes it as the destination page; that is, the search engine now knows that www.domain.com and domain.com are the same thing.