Copied to clipboard

Flag this post as spam?

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


  • Dennis 33 posts 238 karma points
    Nov 17, 2015 @ 09:37
    Dennis
    0

    UrlRewriting.config

    I have multiple domains running, on the same Umbraco installation. On one of the sites I am using url rewriting specified in UrlRewriting.config. My problem is that the following statement works on all domains. I would like the rewriting only to take place on a specific domain, but if I change ~ to my specific domain the routing is not working.

    This example takes all domains:

    <add name="Eventcatering"
         virtualUrl="^~/(?!umbraco|ucommerce|uCommerce)(.*)"
         rewriteUrlParameter="ExcludeFromClientQueryString"
         destinationUrl="~/"
         ignoreCase="true" />
    

    But I need to ensure, I only get routing on my subdomain: test.mysite.dev/

    Does anyone know, how I setup the rule to only apply on my subdomain?

  • Alex Skrypnyk 6150 posts 24110 karma points MVP 8x admin c-trib
    Nov 18, 2015 @ 10:30
    Alex Skrypnyk
    0

    Hi Dennis,

    Can you try like :

    virtualUrl="^~test.mysite.dev/(?!umbraco|ucommerce|uCommerce)(.*)"
    

    Thanks

  • Dennis 33 posts 238 karma points
    Nov 18, 2015 @ 10:44
    Dennis
    0

    Hi Alex,

    Unfortunate that solution don't work. Because the UrlRewriting skips the host if redirect is set to anything other than domain. This is also expected when your working with one website. The problem is that we sometimes in Umbraco has multiple sites, on the same installation (same physical location).

    I actually solved it by writing my own Rewrite-Rule-Provider and extended it with a "domain" property. In the overridden RewriteUrl method I compare the request and if the host is NOT the same as the one defined in the UrlRewriting.config I just redirect the Url otherwise I redirect as described in the "virtualUrl"

    If anyone would like the complete solution I can post it here?

Please Sign in or register to post replies

Write your reply to:

Draft