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

Nice URLs Optimize Webshop Google Page Rank with the Ucommerce E-commerce Framework

In this article we'll briefly explain how to work with SEO friendly URLs in your webshop.

URL Rewrite Rules

Ucommerce utilizes IIS rewrite module, you can download it here: IIS URL Rewrite

Rewrite rules define what URL the customer sees and how the URL should look like to the system.

Working with URLs

The SEO friendly URL is precalculated and ready to use on indexed product and category data. It will even automatically resolve the right language version.

Please see the code below how URLs for products in a product listing can be done.

    var catalogContext = ObjectFactory.Instance.Resolve<ICatalogContext>();
    var urlService = ObjectFactory.Instance.Resolve<IUrlService>();
    var catalogLibrary = ObjectFactory.Instance.Resolve<ICatalogLibrary>();
    
    var currentCatalog = catalogContext.CurrentCatalog;
    var currentCategory = catalogContext.CurrentCategory;
    
    var products = catalogLibrary.GetProducts(currentCategory.Guid);
    
    foreach (var product in products)
    {
        urlService.GetUrl(currentCatalog, catalogContext.CurrentCategories, product);
    }