SEO Mapper Configuration files

Search Engine Optimization was introduced with WCS 5.6.0.2. If this post were to be written for WCS 5.6.0.2, it would be significantly different. SEO mapping configuration got better with each fixpack and matured to a out of box functionality with WCS 5.6.1 and now with 6.0.

If SEO is to be implemented in a production environment, it is imperative that every developer enable SEO in their development environment as well. This post will focus primarily on the configuration files used for SEO mapping in WCS toolkit.

The following are the key configuration files used for working with SEO mappings.

Config.xml
Found in <TOOLKIT_HOME>\conf\xml\ folder, this file is the conterpart of the instance.xml file that is used in the commerce server. Open this file and look for the following line.

<component compClassName=”com.ibm.commerce.datatype.UrlMapperConfig” enable=”false” name=”UrlMapperConfig”>

If it is not already enabled, enable UrlMapperConfig component by changing enable=”true” on this line.

On the next line i.e.
<property UrlMapperFile=”../xml/mapping/newUrlmapper.xml” display=”false”>
<start enabled=”false”/>
</property>

Change UrlMapperFile to “<TOOLKIT_HOME>\conf\xml\mapping\SeoMapper.xml”. Make sure to change TOOLKIT_HOME to the actual path on the file system. This is the path to the seo mapper file. For some reason relative path to this file does not work!

web.xml
Found in <TOOLKIT_HOME>\workspace\Stores\Web Content\WEB-INF\web.xml, this is the configuration file for the web application. This file contains the CacheFilter information that is needed for SEO. The CacheFilter is the gateway between the SEO enabled urls and WAS dynacache. This is usually mapped for you by default. Make sure this file has the following lines:
<filter id=”Filter_1″>
<filter-name>CacheFilter</filter-name>
<display-name>CacheFilter</display-name>
<filter-class>com.ibm.commerce.dynacache.filter.CacheFilter</filter-class>
<init-param id=”InitParam_12″>
<param-name>ServletName</param-name>
<param-value>Stores</param-value>
</init-param>
</filter>

Also under the filter mappings you have the following lines

<filter-mapping id=”FilterMapping_1″>
<filter-name>CacheFilter</filter-name>
<servlet-name>Stores Request Servlet</servlet-name>
</filter-mapping>

SeoMapper.xml
This is the SEO mapper file that is specified in config.xml above. Make sure this file is in the correct location as specified in the config.xml file. Here are some sample contents of this file.

<mappings>
<pathInfo_mappings separator=”|”>
<!–
Non-SEO link: webapp/wcs/stores/servlet/StoreView?storeId=10001
SEO link: webapp/wcs/stores/servlet/store|10001
–>
<pathInfo_mapping name=”store” requestName=”StoreView” >
<parameter name=”storeId” />
</pathInfo_mapping>
<!–
TopCategoriesDisplay: - This is same as the home page.
Non-SEO link: webapp/wcs/stores/servlet/TopCategoriesDisplay?storeId=10001&catalogId=10002&langId=-1&topCatId=10003
SEO link: webapp/wcs/stores/servlet/home|10001|10001|10001|15051
–>
<pathInfo_mapping name=”home” requestName=”TopCategoriesDisplay” >
<parameter name=”storeId” />
<parameter name=”catalogId” />
<parameter name=”langId” />
<parameter name=”topCatId” />
</pathInfo_mapping>
</mappings>

The sample shows only the StoreView and the TopCategoriesDisplay page mappings. Embedded comments show how these mappings are used. You can add almost any other mapping that is needed for the application. Note that the first line indicates the separator used for SEO.

Finally when you start the server, you will see the following lines in the console that explain the status of UrlMapperConfig component:

Initialization has started for “UrlMapperConfig”
Component UrlMapperConfig is enabled.
Initialization complete for “UrlMapperConfig”

Each of these lines will be preceded by a timestamp and other commerce specific information.

If everything is fine you can access the seo page using the following link:
http://localhost/webapp/wcs/stores/servlet/store|10001

Just make sure the storeid is correct and that this mapping is available in the SeoMapper.xml.

As always take a backup of every configuration file that you change in the process.

In conclusion, Commerce makes it extremely easy to configure SEO mapppings. But SEO mappings is only the beginning and there are a several things to consider before your sites ranks high on search engines.

2 Comments

  1. marcus said,

    August 8, 2006 at 11:09 am

    The idea of SEO capabilities in WCS intrigued me so I read this post. The post seems to be quite good at explaining how to enable the SeoMapper (I commend you on the time and effort to write this up in a clear manner).

    I am not sure though, that I understand the reasoning behind doing this. what is the benefit of a url like:
    http://localhost/webapp/wcs/stores/servlet/store|10001

  2. Sahadev said,

    August 8, 2006 at 1:19 pm

    Marcus,
    The answer to your question goes back to my other post on SEO. Here is the link:

    http://www.wcsadmin.com/2006/07/20/introducing-search-engine-optimizationseo/

    The answer in a nutshell is : Search engine spiders have a hard time dealing with URLs that have a long query string. Take a look at the quote from Google in my previous post on SEO.