This post describes some Search Engine Optimization (SEO) Tips for Ecommerce sites running AbleCommerce 7.0.x in a Windows 2008 IIS7 environment. The rules can be used with any web site running on IIS7 and later versions, however the url rewriting code listed below has only been tested with AbleCommerce 7.0.x
Requirements: IIS7, IIS7.5 or later with IIS 7 URL Rewrite Module installed
1. Enforce canonical pages
Search engines believe that http://www.drundo.com and http://www.drundo.com/default.aspx are two separate pages. They believe that these pages have the same content and this affects SEO. The right thing to do here, is HTTP 301 redirect the default.aspx page to http://www.drundo.com by applying the following rule:
<rule name="Default Document" stopProcessing="true">
<match url="(.*?)(/?index\.php$|/?index\.asp$|/?index\.aspx$|/?index\.htm$|/?index\.html$|/?default\.php$|/?default\.asp$|/?default\.htm$|/?default\.html$|/?defaults\.aspx$)"/>
<conditions>
<add input="{PATH_INFO}" pattern="^/admin" negate="true" />
<add input="{PATH_INFO}" pattern="^/checkout" negate="true" />
<add input="{URL}" pattern="WebResource.axd" negate="true"/>
<add input="{URL}" pattern="\.ashx" negate="true"/>
</conditions>
<action type="Redirect" url="{R:1}/" redirectType="Permanent"/>
</rule>2. Enforce Lower Case URLs
URLs can be defined in uppercase and lowercase. That means they are treated as different pages by a search engine, even if they point to the same resources and content. The best way to handle this issue is to rewrite the URL to lowercase and respond to the "old" capitalized version with an HTTP 301 response (Permanently moved).
<rule name="SEO Lower Case URLs" enabled="true" stopProcessing="true">
<match url="[A-Z]" ignoreCase="false"/>
<action type="Redirect" url="{ToLower:{URL}}" redirectType="Permanent" />
<conditions>
<add input="{URL}" pattern="WebResource.axd" negate="true"/>
<add input="{URL}" pattern="ScriptResource.axd" negate="true"/>
<add input="{URL}" pattern="\.ashx" negate="true"/>
<add input="{URL}" pattern="\.css" negate="true"/>
<add input="{URL}" pattern="\.png" negate="true"/>
<add input="{URL}" pattern="\.gif" negate="true"/>
<add input="{URL}" pattern="\.jpg" negate="true"/>
<add input="{URL}" pattern="\.js" negate="true"/>
<add input="{URL}" pattern="\.ttf" negate="true"/>
</conditions>
</rule>
3. Remove URL Trailing Slash
AbleCommerce has internal url rewrting module and most of the product/categories URLs do not directly map to a file or directory on web server’s file system. If a site visitor tries to request these URLs with or without trailing slash he/she will still get the same page. That is OK for human visitors, but may be a problem for search engine crawlers as well as for web analytics services. Different URLs for the same page may cause crawlers to treat the same page as different pages, thus affecting the page ranking. They will also cause Web Analytics statistics for this page to be split up.
<rule name="SEO Remove Trailing Slash" stopProcessing="true">
<match url="(.*)/$" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{URL}" pattern="\.axd$" negate="true"/>
<add input="{URL}" pattern="\.ashx$" negate="true"/>
<add input="{URL}" pattern="\.ajax$" negate="true"/>
</conditions>
<action type="Redirect" url="{R:1}" redirectType="Permanent" />
</rule>
Rules Installation
- open site web.config file located under your site root folder using notepad or other text editor
- locate the system.webserver section at the end of the file
- add the following code under <system.webserver> section tag
<rewrite>
<rules>
<rule name="SEO Lower Case URLs" enabled="true" stopProcessing="true">
<match url="[A-Z]" ignoreCase="false"/>
<action type="Redirect" url="{ToLower:{URL}}" redirectType="Permanent" />
<conditions>
<add input="{URL}" pattern="WebResource.axd" negate="true"/>
<add input="{URL}" pattern="ScriptResource.axd" negate="true"/>
<add input="{URL}" pattern="\.ashx" negate="true"/>
<add input="{URL}" pattern="\.css" negate="true"/>
<add input="{URL}" pattern="\.png" negate="true"/>
<add input="{URL}" pattern="\.gif" negate="true"/>
<add input="{URL}" pattern="\.jpg" negate="true"/>
<add input="{URL}" pattern="\.js" negate="true"/>
<add input="{URL}" pattern="\.ttf" negate="true"/>
</conditions>
</rule>
<rule name="Default Document" stopProcessing="true">
<match url="(.*?)(/?index\.php$|/?index\.asp$|/?index\.aspx$|/?index\.htm$|/?index\.html$|/?default\.php$|/?default\.asp$|/?default\.htm$|/?default\.html$|/?defaults\.aspx$)"/>
<conditions>
<add input="{PATH_INFO}" pattern="^/admin" negate="true" />
<add input="{PATH_INFO}" pattern="^/checkout" negate="true" />
<add input="{URL}" pattern="WebResource.axd" negate="true"/>
<add input="{URL}" pattern="\.ashx" negate="true"/>
</conditions>
<action type="Redirect" url="{R:1}/" redirectType="Permanent" />
</rule>
<rule name="SEO Remove Trailing Slash" stopProcessing="true">
<match url="(.*)/$" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{URL}" pattern="\.axd$" negate="true"/>
<add input="{URL}" pattern="\.ashx$" negate="true"/>
<add input="{URL}" pattern="\.ajax$" negate="true"/>
</conditions>
<action type="Redirect" url="{R:1}" redirectType="Permanent" />
</rule>
</rules>
</rewrite>
- In case your site start showing Internal Server Error 503 remove the rules from your production site web.config file and test the rules on a local machine first. If there is already a <rewrite><rules> section in the config file each rule has to be added as separate <rule> section in addition to all existing rules.
