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, http://myhost.com/shop/en/auroraesite/coffee-makers and how WebSphere Commerce converts the URL back to its original URL format so that it can be processed.
- The web server receives the link http://myhost/shop/en/auroraesite/coffee-makers, replaces shop with the context root: http://myhost/webap/wcs/stores/servlet/en/auroraesite/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".
- 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/auroraesite/coffee-makers) by using the backslash (/) as a separator to retrieve en, auroraesite and coffee-makers.
- 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 - Determining the URL pattern and values:
- 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.
- auroraesite 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.
- 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.
- 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:
- 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:
The values for each parameter is extracted from looking in the SEOURL and SEOURLKEYWORD tables and language registry contents:<seourl:urlToParamMapping> <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:urlToParamMapping>
- For the language, langId = LanguageToken which is -1
- For the store, storeId = StoreToken which is 10001
- For the catalog, catalogId = CatalogToken which is 10002
- 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 auroraesite StoreToken:CatalogToken 10001 (storeId value):10002 (catalogId value) coffee-makers CategoryToken 10003 (categoryId value) en LanguageToken -1 (langId value) - 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):
http://myhost.com/webapp/wcs/stores/servlet/CategoryDisplay?langId=-1&storeId=10001&catalogId=10002&catagoryId=10003
WebSphere Commerce server executes the view with the specified parameters and sends the result to the browser.