Pages

Thursday, June 14, 2012

Implementing SEO on IBM WCS 7 Feature pack 3 or greater

Enabling SEO for a store

Ensure that the store is > FEP3, i.e., FEP3 sar is published and Search based navigation is enabled in management centre. SEO is not enabled by default after publishing the store. We need to enable SEO for a store by inserting a row in the database table SEOURL as below


insert into SEOURL values
(-100001,'StoreToken:CatalogToken','10352:10021',null,null,null,null,0)

We are inserting a token for storeId and catalog id where store id is 10352 and catalogId is 10021.

This will enable the SEO URLs for the store. Also we need to ensure that in our JSP’s all the URL formation has a patternName defined and this patternName should also be defined in a SEO URL Pattern xml file which will be discussed below.  

Getting rid of the /webapp/wcs/stores/servlet context path

Open wc-server.xml and find the element <SEOConfiguration>. Add the following property to the element.

<SEOConfiguration defaultUrl="" dynamicUrl="true" enable="true" >
 <context-root-rewrite value="/shop" />
</SEOConfiguration>

After restarting the server, all URL’s will be rewritten as www.domain.com/shop/..We also need to configure the webserver to pass through all the requests with /shop to /webapp/wcs/stores/servlet (remember we are not actually changing the context root but we are pretending to)

On a IBM HTTP server, the following redirect rule will suffice (usually done in httpd.conf)

## shop url Pass through
RewriteRule /shop/(.*)$ /webapp/wcs/store/servlet/$1  [PT,L,NE]

Generating SEO content for all dynamic categories and products

This is done by using the batch file provided in commerce v7.0 as shown below (assuming db2 database)

From C:\WCDE_ENT70\bin (Commerce installation path)

seourlkeywordgen.bat <<storeId>> <<catalogId>> <<languageId>> <<path to wc-server.xml>> <<path to wc-admin-component of infrastructure-fep component>> <<db2user>> <<dbpassword>>

where
- storeId is the store which owns the catalog
- catalogId is the sales catalog Id for the store
- languageId is -1 for en_US or all for all languages
- path to wc-server.xml in the EAR
- path to infrastructure-fep wc-admin-component.xml  e.g. C:\WCDE_ENT70\workspace\WC\xml\config\com.ibm.commerce.infrastructure-fep\wc-admin-component.xml
db2 user Id
- db2 password 
This will generate the keywords for the products and categories based on the names.

Now every link in the JSPs that are being formed for the categories and products should have a patternName defined. This patternName maps to the one of SEOURLPatterns*.xml which can be found under Stores/WebContent/WEB-INF/xml/seo/stores/<<storename>>