Select version
v7.7 v7.6 v7.5 v7.3 v7.1 v7.0 v6.8 v6.7 v6.6 v6 v5 v4 v3 v2

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.

uCommerce Aps - Studsgade 29B - 8000 Aarhus C - Denmark
Phone +45 61 799 997 - Email info@ucommerce.dk uCommerce logo