Shortening the context root of a migrated local store URL

When you migrate your store from a previous version of HCL Commerce to version 9.0, your store runs on the transaction server (trs-app) and is often referred to as a local store. In addition to running on the transaction server, your local store also uses the transaction web server (trs-web). If you are using a local store, you can shorten the context root of your store's URL to make it easier for shoppers to remember a link. Shorting the context root also improves visibility in search engine results.

About this task

You can shorten the URL for your store by modifying the context root. You can change the default site URL from http://hostname/wcs/shop/servlet/StoreName/index.jsp to something shorter, such as: http://hostname/shop/StoreName/index.jsp. In this example, shop is used to replace the context root, but any name can be used in its place, including a blank context root value.
Important: If there is an invalid protocol or timeout with a redirect, the redirected URL uses the full path, rather than the URL with the shortened context root.


To modify the context root in IBM HTTP Server:
  1. Go to your Docker Web container by running docker exec -it bvt_web_1 bash, then change to the /SETUP/config directory.
  2. Open httpd.conf file for editing.
  3. Ensure that the following line is not commented out:
    LoadModule rewrite_module modules/
  4. Locate the virtualhost object: <VirtualHost servername:80>. This object can display as <VirtualHost *:80>
  5. Insert the following code inside the <VirtualHost servername:80> object before the ending </VirtualHost> tag.
    RewriteEngine on
    RewriteRule ^/shop/(.*) /wcs/shop/servlet/$1 [PT,L]
    If you are specifying a blank context root, use the following format instead:
    RewriteEngine on 
    RewriteRule ^/(?!wcsstore)(.*) /wcs/shop/servlet/$1 [PT,L]
    Using the preceding format when you are specifying a blank context root ensures that the storefront continues to function correctly. Otherwise, you might encounter errors with storefront CSS and images not displaying correctly.
  6. Repeat the preceding step for any other virtual host that your environment uses.
    For example, <VirtualHost servername:443> or <VirutalHost *:8006>.
  7. Save the file.
  8. Restart the IBM HTTP server.

What to do next

Once the rewrite rule is updated in the web server, update the Transaction server configuration file to provide the context root rewrite rule value:
  1. Open the remote store configuration file, which is located in the following directory.


  2. Search for the SEOConfiguration section.
  3. Within the SEOConfiguration section, enter the following code:
    <context-root-rewrite value="/shop" />
    For example:
    <SEOConfiguration defaultUrl="" dynamicUrl="true" enable="true">
    <context-root-rewrite value="/shop" />
  4. Save the file.