Not sure about removing the trailing slash but one of the following rules will 301 redirect the non www address to the www address.
Only enable one of these rules. The first rule will 301 redirect domain.dk to www.domain.dk, the second rule will 301 redirect anything that's not www.domain.dk to www.domain.dk
<!-- SEO: Redirect from the domain without www to the domain with www--> <add name="seoCanonical" virtualUrl="http://domain.dk/(.*)" rewriteUrlParameter="ExcludeFromClientQueryString" destinationUrl="http://www.domain.dk/$1" redirect="Domain" redirectMode="Permanent" ignoreCase="true" />
<!-- SEO: Redirects from any domain to the standard domain--> <add name="seoCanonical" virtualUrl="http://(?!www\.domain.dk).*?/(.*)" rewriteUrlParameter="ExcludeFromClientQueryString" destinationUrl="http://www.domain.dk/$1" redirect="Domain" redirectMode="Permanent" ignoreCase="true" />
Just follow the solution and yes it does work fine however my server is nearly dead as 300 different redirects from old urls to new seems to put the server in a very busy work. So in my opinion it's not proper for serious things, maybe for jsut a generic redirect would be fine but just for this.
301 Redirect domain.dk to www.domain.dk
Hi,
I have a problem I can't figure out how to set up a 301 redirect that redirect from the version of af page like
domain.dk/examplepage to www.domain.dk/examplepage (adds the www to the url) and also how to redirect from
www.domain.dk/examplepage/ to www.domain.dk/examplepage (removing the "/") inside UrlRewriting.config
Not sure about removing the trailing slash but one of the following rules will 301 redirect the non www address to the www address.
Only enable one of these rules. The first rule will 301 redirect domain.dk to www.domain.dk, the second rule will 301 redirect anything that's not www.domain.dk to www.domain.dk
Great Thanks! I will test it!
Or you can use IIRF with an .irf file in each domain root (assuming IIS6)
Example of .irf file:
# remove the #'s to enable the lines of code
# example of .com domain 301 rewrite
# RewriteCond %{HTTP_HOST} ^mydomain\.com$ [I]
# RedirectRule ^/(.*) http://www.mydomain.com/$1 [R=301]
# example of .co.uk domain 301 rewrite
# RewriteCond %{HTTP_HOST} ^mydomain\.co\.uk$ [I]
# RedirectRule ^/(.*) http://www.mydomain.co.uk/$1 [R=301]
If you want to remove the trailing slash, you can use the following rule:
<add name="rewriteFolderSlashes"
virtualUrl="^~/((?!umbraco/).[^?]*)/$"
rewriteUrlParameter="ExcludeFromClientQueryString"
destinationUrl="~/$1" redirect="Application"
ignoreCase="true" redirectMode="Permanent"/>
Hi all,
Just follow the solution and yes it does work fine however my server is nearly dead as 300 different redirects from old urls to new seems to put the server in a very busy work. So in my opinion it's not proper for serious things, maybe for jsut a generic redirect would be fine but just for this.
Cheers, Giorgos
Thanks so easy
is working on a reply...