Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


These support forums are now closed for new topics and comments.
Please head on over to http://eureka.ucommerce.net/ for support.

  • Dan Sunesen 45 posts 145 karma points
    Feb 06, 2013 @ 15:14
    Dan Sunesen
    0

    Multilingual shop and rewriting urls

    So I have this shop, where my node structure looks like this:

    Content
    -- Splash
    ---- Website (en)
    ---- Website (es)
    ---- Website (de)

     

    In my /config/urlRewriting.config, I have the following :

    <add name="DefaultCategoryProductRewrite" virtualUrl="(.*)/c-([0-9]+)/c-([0-9]+)/p-([0-9]+)" rewriteUrlParameter="ExcludeFromClientQueryString" destinationUrl="~/en/products/product.aspx?catalog=$2&amp;category=$3&amp;product=$4" ignoreCase="true" xmlns="" />

        <add name="DefaultProductRewrite" virtualUrl="(.*)/c-([0-9]+)/p-([0-9]+)" rewriteUrlParameter="ExcludeFromClientQueryString" destinationUrl="~/en/products/product.aspx?catalog=$2&amp;product=$3" ignoreCase="true" xmlns="" />

        <add name="DefaultCategoryRewrite" virtualUrl="(.*)/c-([0-9]+)/c-([0-9]+)" rewriteUrlParameter="ExcludeFromClientQueryString" destinationUrl="~/en/products/catalog.aspx?catalog=$2&amp;category=$3" ignoreCase="true" xmlns="" />

        <add name="DefaultCatalogRewrite" virtualUrl="(.*)/c-([0-9]+)" rewriteUrlParameter="ExcludeFromClientQueryString" destinationUrl="~/en/products/catalog.aspx?catalog=$2" ignoreCase="true" xmlns="" />

    On the homepage of the site, I have links to each product. When I click a product (on the english version of the page), I get to http://domainname.com/ucommerce/category/product/c-23/c-69/p-163/?sku=23106

    Now, say I'm on the Spanish version of the site (http://domainname.com/es) and I click a product on the frontpage, I get redirected to the english version. How do I get this working?

     

    I thought I could add extra "rules" to the .config-file, where I gave them other names and replaced ~/en/ with ~/es/ and ~/de/ - but that doesn't seem to work.

     

    Could someone guide me in the right direction?

     

    Br
    Dan

     

  • Dan Sunesen 45 posts 145 karma points
    Feb 07, 2013 @ 09:43
    Dan Sunesen
    0

    Should I restructure my site, or is it possible to write more url rewriting rules?

  • Dan Sunesen 45 posts 145 karma points
    Feb 07, 2013 @ 11:24
    Dan Sunesen
    0

    I found this post: http://our.umbraco.org/projects/website-utilities/ucommerce/ucommerce-support/37239-Multilingual-content

    The last comment from Søren; To me it sounds like I can add more rules?

  • Niels Jorck Ellegaard 39 posts 245 karma points
    Feb 07, 2013 @ 11:46
    Niels Jorck Ellegaard
    0

    I don't believe it is a problem with the rewrite rules. You shouldn't have to tingle with them at all.

    I'm guessing it is a problem with language, either in Umbraco or uCommerce.

    On your frontpage you have some code to pull out your products. Could it be you get the wrong language version of the products there and therefore get the wrong link?

  • Nickolaj Lundgreen 233 posts 1132 karma points
    Feb 07, 2013 @ 13:08
    Nickolaj Lundgreen
    1

    Hi Dan

    I think you are on the right track with the rewrite rules

    The "right" way would be to "capture" the language part of the virtual url (like you do with the catalog,category and product id), and insert that one in the destinationurl.

    The easy way would be to add a set of the 4 rules for each language.

  • Niels Jorck Ellegaard 39 posts 245 karma points
    Feb 07, 2013 @ 13:17
    Niels Jorck Ellegaard
    0

    Hi Dan.

    Nickolaj poked me and my sickridden brain telling me I was wrong. I'm sorry I didn't catch it myself.

    I would still like to help though with the redirects. I'm not 100% sure, where the virtualUrl start, if it catches the domain aswell or just the url. But I'm guessing it is just the url. You probably have to play a little with it. Anyway, my two cents.

    <add name="DefaultCategoryProductRewrite" virtualUrl="^/(.+){2}/(.*)/c-([0-9]+)/c-([0-9]+)/p-([0-9]+)" rewriteUrlParameter="ExcludeFromClientQueryString" destinationUrl="~/$1/products/product.aspx?catalog=$3&amp;category=$4&amp;product=$5" ignoreCase="true" xmlns="" />

        <add name="DefaultProductRewrite" virtualUrl="^/(.+){2}/(.*)/c-([0-9]+)/p-([0-9]+)" rewriteUrlParameter="ExcludeFromClientQueryString" destinationUrl="~/$1/products/product.aspx?catalog=$3&amp;product=$4" ignoreCase="true" xmlns="" />

        <add name="DefaultCategoryRewrite" virtualUrl="^/(.+){2}/(.*)/c-([0-9]+)/c-([0-9]+)" rewriteUrlParameter="ExcludeFromClientQueryString" destinationUrl="~/$1/products/catalog.aspx?catalog=$3&amp;category=$4" ignoreCase="true" xmlns="" />

        <add name="DefaultCatalogRewrite" virtualUrl="^/(.+){2}/(.*)/c-([0-9]+)" rewriteUrlParameter="ExcludeFromClientQueryString" destinationUrl="~/$1/products/catalog.aspx?catalog=$3" ignoreCase="true" xmlns="" />

    I try to catch the language, which is set to 2 characters long right at the beginning of the url and then put it in the destination url at the beginning.

    I'm not 100% sure it fits your needs completely, nor that it actually works, but I hope it helps.

  • Dan Sunesen 45 posts 145 karma points
    Feb 07, 2013 @ 14:33
    Dan Sunesen
    0

    Yo dudes! I'll try it out!... Hang on!

  • Dan Sunesen 45 posts 145 karma points
    Feb 07, 2013 @ 14:51
    Dan Sunesen
    0

    Hm... That gives me: 

    404 - File or directory not found.

     

    :(

     

    More info about my setup:
    Each website has hostnames, fx.: website.com/en, website.com/es, website.com/cz

    ..with each their language selected.

    The Splash Page node has a "umbracoInternalRedirectId" pointing to the /en site.

    I also noticed that the products links to the same path (website.com/ucommerce/bla/bla/bla) - Shouldn't it be website.com/es/ucommerce when I'm on the spanish site, website.com/cz/ucommerce when i'm on the czech site?

     


     

  • Nickolaj Lundgreen 233 posts 1132 karma points
    Feb 07, 2013 @ 15:12
    Nickolaj Lundgreen
    0

    Could you post how your urlRewriting.config looks?

  • Niels Jorck Ellegaard 39 posts 245 karma points
    Feb 07, 2013 @ 15:30
    Niels Jorck Ellegaard
    0

    I noticed in the links you wrote /ucommerce/ but in the rules you specify /products/
    How is your content section put together?

    Content
    -Splash
    --en
    ---? products or ucommerce?
    ----catalog
    -----category
    ------product
    --cz
    ---? 
     

  • Dan Sunesen 45 posts 145 karma points
    Feb 07, 2013 @ 18:23
    Dan Sunesen
    0

    Content
    -- Splash
    ---- Website (en)
    ------- products 
    ---------- product
    ---- Website (es)
    ------- products 
    ---------- product
    ---- Website (de)
    ------- products 
    ---------- product

    But maybe I need to have one step more? 

    Content
    -- Splash
    ---- Website (en)
    ------- catalog
    --------- products (category) 
    ------------ product
    ---- Website (es)
    ------- catalog
    --------- products (category) 
    ------------ product 
    ---- Website (de)
    ------- catalog
    --------- products (category) 
    ------------ product
     

    I'll post the urlRewriting.config in about an hour (not at my work laptop atm.)

  • Dan Sunesen 45 posts 145 karma points
    Feb 07, 2013 @ 19:45
    Dan Sunesen
    0

    This is how my urlRewriting.config looks like atm:

    <?xml version="1.0" encoding="utf-8"?>

    <urlrewritingnet xmlns="http://www.urlrewriting.net/schemas/config/2006/07">
       <rewrites>

     

        <add name="DefaultCategoryProductRewrite" virtualUrl="(.*)/c-([0-9]+)/c-([0-9]+)/p-([0-9]+)" rewriteUrlParameter="ExcludeFromClientQueryString" destinationUrl="~/en/products/product.aspx?catalog=$2&amp;category=$3&amp;product=$4" ignoreCase="true" xmlns="" />

        <add name="DefaultProductRewrite" virtualUrl="(.*)/c-([0-9]+)/p-([0-9]+)" rewriteUrlParameter="ExcludeFromClientQueryString" destinationUrl="~/en/products/product.aspx?catalog=$2&amp;product=$3" ignoreCase="true" xmlns="" />

        <add name="DefaultCategoryRewrite" virtualUrl="(.*)/c-([0-9]+)/c-([0-9]+)" rewriteUrlParameter="ExcludeFromClientQueryString" destinationUrl="~/en/products/catalog.aspx?catalog=$2&amp;category=$3" ignoreCase="true" xmlns="" />

        <add name="DefaultCatalogRewrite" virtualUrl="(.*)/c-([0-9]+)" rewriteUrlParameter="ExcludeFromClientQueryString" destinationUrl="~/en/products/catalog.aspx?catalog=$2" ignoreCase="true" xmlns="" />

     

      </rewrites>
    </urlrewritingnet>

     

    I went back to the one that didn't give me a 404..

  • Dan Sunesen 45 posts 145 karma points
    Feb 08, 2013 @ 11:02
    Dan Sunesen
    0

    So should I do something with the urlRewriting and the actucal structure of my site in order to make it work?

  • Dan Sunesen 45 posts 145 karma points
    Feb 09, 2013 @ 17:23
    Dan Sunesen
    0

    Any other suggestions?

  • Dan Sunesen 45 posts 145 karma points
    Feb 10, 2013 @ 01:27
    Dan Sunesen
    100

    With a little (big) help from @greystate, I got it working:

     

    <add

    name="DefaultCategoryProductRewriteEN"

    rewriteUrlParameter="ExcludeFromClientQueryString"

    virtualUrl="~/en/(.*)/c-([0-9]+)/c-([0-9]+)/p-([0-9]+)"

    destinationUrl="~/en/products/product.aspx?catalog=$2&amp;category=$3&amp;product=$4" ignoreCase="true"

    />

     

    <add

    name="DefaultCategoryProductRewriteES"

    rewriteUrlParameter="ExcludeFromClientQueryString"

    virtualUrl="~/es/(.*)/c-([0-9]+)/c-([0-9]+)/p-([0-9]+)"

    destinationUrl="~/es/productos/product.aspx?catalog=$2&amp;category=$3&amp;product=$4" ignoreCase="true"

    />

Please Sign in or register to post replies

Write your reply to:

Draft