Maintaining URL Consistency
Source: Professional Search Engine Optimization with ASP.NET: A Developer's Guide to SEO
by Cristian Darie and Jaimie Sirovich
Wrox Press © 2007
No matter if your URLs are static or dynamic, it's important to maintain consistency. In the case of dynamic URLs, it's important to maintain consistent parameter order in URLs with more than one parameter.
In ASP.NET, the parameters of a query string are typically accessed by name rather than by ordinal. The order in which the parameters appear does not affect the output of the ASP.NET page, unless your script is specifically written to take parameter order into consideration. Here is an example where an ASP.NET web site would generate the exact same content, but using different URLs:
http://www.example.com/Catalog.aspx?ProductID=1&CategoryID=2
http://www.example.com/Catalog.aspx?CategoryID=2&ProductID=1
If Catalog.aspx reads the parameters as Request.QueryString[“ProductID”] and Request .QueryString[“CategoryID”], respectively, these two different URLs would generate the same content. There's no standard specifying that URL parameters are commutative. If both dynamic links are used within the web site, search engines may end up parsing different URLs with identical content, which could get the site penalized.
The programmer should also try to use consistent capitalization on file names and query strings. Search engines resolve such simple differences, especially because file names in Windows are not case sensitive, but the following URLs are technically different in both Windows and Unix operating systems:
http://www.example.com/products.aspx?color=red
and
http://www.example.com/PRODUCTS.ASPX?color=RED
Your script may recognize the equivalence of those URLs, but a search engine may not. Again, maintaining a consistent style is desirable. The developer should also try to reference directories in a web site with the trailing “/” consistently. For example, if you're using numeric rewritten URLs, it would be best to avoid referencing a particular product using both of the following links, even if your script can successfully parse them:
http://www.example.com/Products/1/
and
http://www.example.com/Products/1
In practice, search engines can resolve many of these ambiguities. Matt Cutts asserts that Google can “do things like keeping or removing trailing slashes, [and try] to convert urls with upper case to lower case” (http://www.mattcutts.com/blog/seo-advice-url-canonicalization/), but this is only a subset of the aforementioned ambiguities. It is best to remove all of the offending ambiguities regardless.
To enforce consistency as a whole, you can create a function for each type of URL required by a site. Through the logic in that function URLs are consistently formatted. Consistency also makes it easier to exclude files in robots.txt, as the preceding problems having to do with ordering and casing also apply there.
For example, if you're building an e-commerce web site, you could create a function such as the following:
public static string CreateLink(int categoryId, int productId)
{
return "Product.aspx?CategoryID=" + categoryId + "&ProductID=" + productId;
}
Calling this function providing 5 and 6 as parameters, it will return Product.aspx?CategoryID= 5&ProductID=6. Using this function throughout the web site will ensure all your links follow a consistent format.
This implementation of CreateLink() is overly simplistic and not really useful for real-world scenarios. If you want to improve your URLs more significantly, you need to utilize more advanced functions in coordination with URL rewriting. The benefits of URL consistency will also apply there. So without further ado, let's learn about this subject.
Monday, August 31, 2009
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment