Sha
Sha

Reputation: 2397

Umbraco URL rewriting with tld catchall

I have a lot of different top level domains, e.g. .co.uk, .us, .it and so on, but I have trouble setting up correct redirection rule for top level domains. I am using Umbraco URL rewriting.

I trying to setup a generic rule for all top level domains to redirect to a new subdomain for each tld, e.g. www.mysite.tld/somepage should point network.mysite.tld/somepage.

Something like this:

Before:
www.mysite.co.uk/network/123 
www.mysite.us/network/123
...

After:
network.mysite.co.uk/123 
network.mysite.us/123 
...

This is my redirection rule, but it does not work:

<add name="NewSubDomain" redirect="Domain" 

virtualUrl="http://www.mysite.(.*)/network/(.*)" 
destinationUrl="http://network.mysite.$1/$2" 

rewriteUrlParameter="ExcludeFromClientQueryString"     
ignoreCase="true" />

Can anybody recommend a solution to this - seems like urlrewriting does not accept .tld as parameter?

Upvotes: 0

Views: 381

Answers (1)

Sha
Sha

Reputation: 2397

Just figured it out using Fiddler.

Apparently getting the .tld is impossible and instead Umbraco redirect will get the whole domain name (mysite.tld) without subdomain (www.). This is my working solution.

<add name="NewSubDomain" redirect="Domain" 

virtualUrl="^http\://www.(.*)/network/(.*)" 
destinationUrl="http://network.$1/$2" 

rewriteUrlParameter="ExcludeFromClientQueryString"     
ignoreCase="true" />

Upvotes: 1

Related Questions