Have you noticed that a page in Sitecore 6 can be accessed through several URL’s? This is an example of the products page on the Sitecore website. The following URL’s are all valid and points to the same page and the same language:
http://www.sitecore.net/en/Products.aspx
http://www.sitecore.net/Products.aspx
http://www.sitecore.net/Products.aspx?sc_lang=en
http://www.sitecore.net/Products
http://www.sitecore.net/?sc_itemid={5D8489BF-419B-4336-B9DA-CA704C682B51}
This can confuse statistical tools like Google Analytics, as the statistical data is collected per URL basis. Sitecore’s own Online Marketing Suite does not have this problem, but all tools that collects data from Javascripts inserted on the page will get confused. It is hard to get a total number of hits for one page, as you have to collect the statistics scattered over many URL’s.
So how can you limit the number of URL’s to one page? The solution lies within the linkManager setting in web.config:
<linkManager defaultProvider="sitecore">
<providers>
<clear />
<add name="sitecore" type="Sitecore.Links.LinkProvider, Sitecore.Kernel"
addAspxExtension="true"
alwaysIncludeServerUrl="false"
encodeNames="true"
languageEmbedding="asNeeded"
languageLocation="filePath"
shortenUrls="true"
useDisplayName="false" />
</providers>
</linkManager>
These are the default settings in the web.config, which allows the widest range of available URL’s per page. But this is not always a good thing. The following settings caught my eye:
languageEmbedding="asNeeded"
This setting allows Sitecore to add the language as a part of the URL “as needed”. In practice this means “as the wind blows” because it is very hard to find a pattern for when the language is added and not. My recommentation is to use “always” for multiple language sites, and “never” for single language sites.
Another cool setting is this:
addAspxExtension="true"
Setting this to “false” removes the .aspx extension for all URL’s. In order for this to work you will need to use IIS7 and map all incomming requests to ASP.NET, or write your own 404 error handler that redirects any incomming request to the correct .aspx page.

September 11, 2009 at 12:16 pm
Thanks for the article. I don’t think you need II7 to use addAspxExtensino=false though; in IIS6, associating wildcard mappings with ASP.NET ISAPI should do.
September 14, 2009 at 10:39 pm
Excellent article. Also another thing to point out is that one should always use the built in methods and controls in the Sitecore API when dealing with links to assure that they are handled by the linkmanager instead of simply accessing link fields as raw text and programmatically constructing links. This will insure that the links always comply with the rules specified in the web.config.
September 21, 2009 at 10:53 am
[...] September 21, 2009 — briancaos In my previous post (LinkManager – Working with URL’s in Sitecore 6) I was quite enthusiastic about the addAspxExtension feature, which allows you to disable the .aspx [...]
March 12, 2010 at 11:07 am
[...] approach is to use the Sitecore LinkManager to embed the language into the URL of the site. This solution is session-less and allows multiple [...]
March 12, 2010 at 5:15 pm
If you use aliases, you might want to use them consistently, so that search engines don’t index the same content twice. I wrote a blog post about this, but I can’t vouch for the code.
http://sitecorejohn.spaces.live.com/blog/cns!960125F1D4A59952!167.entry