Documentation

Ucommerce includes full API reference documentation and lots of helpful articles to help you build your e-commerce site as effortlessly as possible.

Topics Payment Providers
v7.18

Setting Up Simple URL Rewriting In Ucommerce

With Ucommerce comes a simple sample implementation of a complete store, which you can use as inspiration for getting started. image

The sample store uses the query string to pass catalog-, category-, and product names when redirecting to other pages where this information is needed, for example when browsing the catalog.

If you want search engine friendly URLs instead, you can configure Umbraco’s URL rewriting to include your Ucommerce content too, and here is how.

Open the file UrlRewriting.config placed in the /config folder in the root of your Umbraco installation, and add the following elements to the element:

    
    	<add name="ProductRewrite"
    		 virtualUrl="^/shop/(.*)/(.*)/(.*).aspx"
    		 rewriteUrlParameter="ExcludeFromClientQueryString"
    		 destinationUrl="~/shop/product.aspx?catalog=$1&category=$2&product=$3"
    		 ignoreCase="true"/>
    
    	<add name="CategoryRewrite"
    		 virtualUrl="^/shop/(.*)/(.*).aspx"
    		 rewriteUrlParameter="ExcludeFromClientQueryString"
    		 destinationUrl="~/shop/catalog.aspx?catalog=$1&category=$2"
    		 ignoreCase="true"/>
    
    	<add name="CatalogRewrite"
    		 virtualUrl="^/shop/(.*).aspx"
    		 rewriteUrlParameter="ExcludeFromClientQueryString"
    		 destinationUrl="~/shop/catalog.aspx?catalog=$1"
    		 ignoreCase="true"/>
    

This gives you pretty URLs, like these for example:

Page Sample url
Ucommerce catalog /shop/ucommerce.aspx
Software category /shop/ucommerce/software.aspx
Product with SKU 100-000-001 /shop/ucommerce/software/100-000-001.aspx

Note that you still need to modify the links in the XSLT files for the sample store to generate these URLs.

The examples above are simple examples, which you probably need to adjust to your client’s needs, and your site structure. For a more comprehensive documentation on how to configure rewriting, check out the documentation for the UrlRewrite.net component that Umbraco uses.