Basically www.domain2.com is the live website, and all other domains should redirect to this one (using 301 permanent redirect for SEO purposes)
I have discovered that the urlrewriting.net engine is already used by Umbraco, so this is the natural choice of rewriting engines to use.. i'm just wondering if anybody has written a regular expression to do what i need (change the domain name, keep the rest of the url the same)?
And if that somebody has it setup in a rewrite rule in UrlRewriting.config and can provide the whole rule, that'd be even more supremo.
Thanks heaps
Greg
ps: Site is running Umbraco 3.0.5 - if i upgrade to v4.0, are there any changes required for the rewriting rules?
No need for physical files to exist, however, are you running IIS 6 or IIS 7? If you are running IIS 6, then you'll also need to add a wildcard mapping to the aspnet isapi DLL. Of the top of my head, you need to go to the home tab for your IIS website, click configuration and in the bottom of the window there's an area that says wildcard mapping. You need to add a reference to aspnet_isapi.dll (or something ... ) from your windows/microsoft.net/(your .net version)... and make sure your set the checkbox correctly so that it doesn't verify that the file exists (otherwise, you would need a real file). IIS 7 doesn't need to use wildcard mappings.
Thats weird... i fixed the problem almost right away, and came back and said that it was cos of the missing quotation mark.. but that post got lost somehow. hmmmm... this forum is cool, but definitely still a little quirky.
Just to sum up so everybody gets it right. All credits goes to the members above.
This 301 redirect vil make your site go from www.domain.dk/test to domain.dk/test (without www), so the search engines only will crawl one domain and avoid double content.
Using UrlRewriting to redirect domain
hey all,
I need to setup some redirections on a website, as follows:
www.domain1.com/page1.aspx > www.domain2.com/page1.aspx
www.domain3.com/page2.aspx > www.domain2.com/page2.aspx
Basically www.domain2.com is the live website, and all other domains should redirect to this one (using 301 permanent redirect for SEO purposes)
I have discovered that the urlrewriting.net engine is already used by Umbraco, so this is the natural choice of rewriting engines to use.. i'm just wondering if anybody has written a regular expression to do what i need (change the domain name, keep the rest of the url the same)?
And if that somebody has it setup in a rewrite rule in UrlRewriting.config and can provide the whole rule, that'd be even more supremo.
Thanks heaps
Greg
ps: Site is running Umbraco 3.0.5 - if i upgrade to v4.0, are there any changes required for the rewriting rules?
Documentation can be found here:
http://www.urlrewriting.net/160/en/documentation.html
You'll need to setup a domain redirect such as:
<add name="asdfasdf"
redirect="Domain"
ignoreCase="true" rewriteUrlParameter="IncludeQueryStringForRewrite"
virtualUrl="http://www.domain1.com/(.*)
destinationUrl="http://www.domain2.com/$1"
/>
With domain redirects, you need to include the http:// syntax for your Urls.
Thanks Shannon, but that didn't work for me... i get this error:
any ideas why?
damn... the pasted error looked great in the edit window, but got mangled in the display... anyway, you can still get the idea.
i noticed in the documentation it says this:
desitnationUrl
regular expression replacement term
A regular expression term describing the target page (physical file)
Does this mean it requires a path to a physical file? if so, how would i get it to change the actual domain its redirecting to?
Doh! sorry, what i posted is missing a closing quotation mark, I had:
virtualUrl="http://www.domain1.com/(.*)
originally, but you need:
virtualUrl="http://www.domain1.com/(.*)"
This is why your getting a config error.
No need for physical files to exist, however, are you running IIS 6 or IIS 7? If you are running IIS 6, then you'll also need to add a wildcard mapping to the aspnet isapi DLL. Of the top of my head, you need to go to the home tab for your IIS website, click configuration and in the bottom of the window there's an area that says wildcard mapping. You need to add a reference to aspnet_isapi.dll (or something ... ) from your windows/microsoft.net/(your .net version)... and make sure your set the checkbox correctly so that it doesn't verify that the file exists (otherwise, you would need a real file). IIS 7 doesn't need to use wildcard mappings.
Hope this helps!
Thats weird... i fixed the problem almost right away, and came back and said that it was cos of the missing quotation mark.. but that post got lost somehow. hmmmm... this forum is cool, but definitely still a little quirky.
Your example above return a 302 - which is not good ?
I have succeeded in UrlRewriting.config (/config/UrlRewriting.config) to achieve a clean 301 - Example below:
<add name="just-a-name-fo-you-know-which-one"
redirect="Domain"
ignoreCase="true" rewriteUrlParameter="IncludeQueryStringForRewrite"
virtualUrl="http://www.someothersite.dk/(.*)"
redirectMode="Permanent"
destinationUrl="http://www.myrealsite.nu" />
Cheers!
Just to sum up so everybody gets it right. All credits goes to the members above.
This 301 redirect vil make your site go from www.domain.dk/test to domain.dk/test (without www), so the search engines only will crawl one domain and avoid double content.
Edit: UrlRewriting.config (/config/UrlRewriting.config)
Cheers !
Hi Søren.
Im trying to deal with the same issue, however im not sure which part of your code i need to fill out with my own data, and with what.
Could you make that more clear to help me out? :) Basically all i want is that my webpage never uses www in the url.
Cheers.
It took me quite some time to figure out I can only link one domain to another domain, not a route to another domain, for anyone reading...
is working on a reply...