Introduced in Feature Pack 3

SEO-friendly URL deconstruction overview

When a shopper clicks on a link for a page in the store, they see an SEO-friendly URL. WebSphere Commerce can process the embedded category, store name, language, and product information only if this SEO-friendly URL is translated to the standard URL format. To translate the SEO-friendly URL to the standard URL, use the SEOURL, SEOURLKEYWORD and SEOTOKENUSGTYPE) and a URL pattern definition file.

Translating an SEO-friendly URL to a traditional URL:

This example describes how a customer reaches the SEO-friendly URL for the coffee-makers category, and how WebSphere Commerce converts the URL back to its original URL format so that it can be processed.

The following steps explain the process involved in translating SEO-friendly URL to traditional URL.
  1. The web server receives the link http://myhost/shop/en/madisons/coffee-makers, replaces shop with the context root: http://myhost/webap/wcs/stores/servlet/en/madisons/coffee-makers. The web server sends a request to the WebSphere Commerce server for further processing. This example assumes the context root has been replaced with "shop".
  2. When the WebSphere Commerce server receives the URL, it removes the context root and then processes the remaining information. The rest of the information is divided into keywords (en/madisons/coffee-makers) by using the backslash (/) as a separator to retrieve en, madisons and coffee-makers.
  3. The keywords are used for two purposes in translating a URL; to determine the URL pattern, which indicates the kind of URL construction, and to obtain the necessary values to build the original URL.
    Sample URL types:
    URL type Pattern Sample non-SEO URL
    Catalog LanguageToken/StoreToken:CatalogToken ...TopCategoriesDisplay?langId=-1&storeId=10001&catalogId=10002
    Category LanguageToken/StoreToken:CatalogToken/CategoryToken ...CategoryDisplay?langId=-1&storeId=10001&catalogId=10002&categoryId=10003
    Product LanguageToken/StoreToken:CatalogToken/CategoryToken/ProductToken ...ProductDisplay?langId=-1&storeId=10001&catalogId=10002&categoryId=10003&productId=10004
    Contact Us LanguageToken/StoreToken:CatalogToken/ContactToken ...HelpContactUsView?langId=-1&storeId=10001&catalogId=10002
  4. Determining the URL pattern and values:
    1. The keywords are translated into tokens. The keywords are stored in multiple places, depending on the keyword type. Language keywords are stored in the language registry which pulls contents from the LANGUAGE table, while other keywords are stored in the SEOURLKEYWORD table:
      • en is found in the language registry. Because only languages are stored here, this determines that its token is LanguageToken. The value for en is -1.
      • madisons is found in the SEOURLKEYWORD table, where it is listed as a combination of a StoreToken and a CatalogToken (eg. StoreToken:CatalogToken ) with values of 10001 and 10002 respectively and represented as 10001:10002.
      • coffee-makers is found in the same table, where it is listed as a CategoryToken with a value of 10003.
    2. With these tokens, the pattern is LanguageToken/StoreToken:CatalogToken/CategoryToken. To determine the type of URL that is being deconstructed, the system finds the correct pattern in the pattern file(s). Pattern files contain patterns for every type of web page in the store, such as category, department, product, help, or other page.
      Example of a matching pattern
      <seourl:seoUrlPatternDef name="CategoryURL">
      		<seourl:seoUrlPattern viewName="CategoryDisplay">/LanguageToken/StoreToken:CatalogToken/CategoryToken</seourl:seoUrlPattern>
      			<seourl:mapping name="langId" value="?LanguageToken?" />
      			<seourl:mapping name="storeId" value="?StoreToken?" />
      			<seourl:mapping name="catalogId" value="?CatalogToken?" />
      			<seourl:mapping name="categoryId" value="?CategoryToken?" />
      			<seourl:mapping name="LanguageToken" value="?langId?" />
      			<seourl:mapping name="StoreToken" value="?storeId?" />
      			<seourl:mapping name="CatalogToken" value="?catalogId?" />
      			<seourl:mapping name="CategoryToken" value="?categoryId?" />
        <seourl:usage device="browser">
  5. The viewName attribute of this pattern indicates that the SEO-friendly URL is actually a CategoryDisplay struts action. Using the information found in the section named urlToParamMapping, the paramaters are extracted from the SEOURLKEYWORD table:
    			<seourl:mapping name="langId" value="?LanguageToken?" />
    			<seourl:mapping name="storeId" value="?StoreToken?" />
    			<seourl:mapping name="catalogId" value="?CatalogToken?" />
    			<seourl:mapping name="categoryId" value="?CategoryToken?" />
    The values for each parameter is extracted from looking in the SEOURL and SEOURLKEYWORD tables and language registry contents:
    1. For the language, langId = LanguageToken which is -1
    2. For the store, storeId = StoreToken which is 10001
    3. For the catalog, catalogId = CatalogToken which is 10002
    4. For the category, categoryId = CategoryToken which is 10003
    A sample combination of SEOURL and SEOURLKEYWORD tables and language registry contents. This table is for illustration purposes only:
    Keyword Token Name Token Value
    madisons StoreToken:CatalogToken 10001 (storeId value):10002 (catalogId value)
    coffee-makers CategoryToken 10003 (categoryId value)
    en LanguageToken -1 (langId value)
  6. With the information found in the SEOURLKEYWORD table, the non SEO-friendly URL is constructed in the formatting found in the pattern file (LanguageToken/StoreToken:CatalogToken/CategoryToken):

    WebSphere Commerce server executes the view with the specified parameters and sends the result to the browser.