Serves You Rewrite

Written by Intern - 01 Aug 2007

The SEO benefits of static URL’s over dynamic URL’s have been a widely discussed topic for quite some time, but with the increase of eCommerce sites requiring good search engine positions, it is now a crucial part of many SEO campaigns.

So what are the differences?

Let’s take a simple example to illustrate the pro’s and con’s of both. We have an online store containing around 1,000 home accessories, the URL for a product category page may look something like this:

Static URL -

Dynamic URL -

The first example shows some obvious benefits – it is user-friendly, easy to identify the product, and contains some useful keywords. However, this would require a separate hand coded page for each product. New products and product updates would need to be done manually. This would be a real headache for any site with more than a handful of products.

The second example uses a PHP script to query the database and display the requested product details. Typically, all the products would be displayed via a single template page, making adding products or updating the site extremely quick and easy. However, the URL is anything but user-friendly, it is not easily remembered, and contains no keywords. Worst of all, search engines really do not get on well with dynamic URL’s.

Further Breakdown

Let’s take two more dynamic URL’s as examples:

Even in this unfriendly format it is easy for us to see that these should show us 2 different products. In an effort to index only unique and relevant pages, many search engines will cut off a URL after a certain number of variables have been encountered. In the examples above this could either beak the links completely (as the database would receive insufficient variables to identify the products), or if only one variable were to be passed (up to the first &), we would end up with duplicate URL’s and therefore no indexing of our content.

Keywords in URL’s

We all know the importance of keywords to Google, Yahoo! and MSN, and this is no less so when it comes to URL’s. Just take a look at a few top ranking sites to see some examples. So what is the answer? In brief the solution is commonly referred to as ‘server rewrites’.

The specifics for applying server rewrites will depend on which platform your server is hosted on. A common scenario for example would be a Linux Server running Apache. Providing that the ‘Mod Rewrite’ module has been installed on the server, you can make use of the ‘.htaccess’ file to store any number of ‘rules’. These rules silently redirect browsers and search engines to the required pages, while serving up a search engine friendly URL.

There are a number of rules and conditions available to the rewrite module, and it is beyond the scope of this article to list or explain them all, but here are two of the most important techniques.

Static Rules - these simply map one page to another, e.g.

RewriteRule ^cheese-knives\.htm      /product.php?tpid=540&cid=182&tpid=133

RewriteRule ^coffee-grinder\.htm      /product.php?tpid=540&cid=165&tpid=134

What the browser (and the search engine) will see is www.yourdomain/cheese-knives.htm, the database on the other hand will receive the variables it requires to display the required products.

Dynamic Rules – these are much more powerful regular expressions, e.g.

RewriteRule ^([a-zA-Z]{1}[^.]+)\.htm$      /category.php?cat=$1 [L]

In the example above, this rule uses regular expressions to translate a friendly URL such as ‘kitchen-accessories.htm’ or ‘LCD-televisions.htm’ into the required format for the database to display the contents of the given category. The dynamic element of the left hand side (within the rounded brackets) is passed on to the dynamic URL as a variable that replaces ‘$1’.

Haven Direct Home Furnishings is one of the latest Fresh Egg Customers to undergo a server rewrite as part of their search engine optimisation, and we expect to see a significant increase in their positions as a result.

To see two very good examples of websites where effective rewrite rules have already been in place for some time, take a look at Apuldram Roses and Wineware. Both of these sites are enjoying high ranking positions for some very competitive keywords.