I have a site (Umbraco 4.0.2.1 on Windows 2008 server) where the client asked me to implement a "hard redirect" or 301 redirect, so all visits to domain.dk is redirected to www.domain.dk.
After reading other posts around here i added this to my urlrewriting.config file:
This is "normal" behavior since the idea of the urlrewriting is that you get redirected to another page "behind the scenes" so that it is transparent to the end user.
I think what you have to do is test in your codebehind if the user comes in with the "domain.dk", and in that case do a Response.RedirectPermanent() to the www.domain.dk page.
Try changing redirect="Domain" to redirect="Application" ,
User should see themselves bounced to new domain (i.e. www.domain.dk)
Firebug net panel will also show you that client is receiving the correct status codes. I.e. 301 for domain.dk and then 200 for www.domain.dk (this is good, as it means that google's index will also see it, and only index the www version of the site)
I have unfortunately no idea if it will be picked up as www.domain.dk, but my feeling is that it will not: the urlrewriting is more an internal tool to tell the engine where to actally go look for the data to display, so I don't think that the client gets any information about this.
About the redirect, if should not be so tedious if you have one "root" master template from which all other templates inherit, because then you need to implement the redirect only once in the root template. Also, I am not 100% sure about this, but I think you could actually do the check in the global.asax file (in Application_BeginRequest or something like this).
And once the user has been redirected to www domain, the subsequent links will send it directly to the www.domain.uk page, so the redirect will be performed on the first client request only.
urlrewriting.config is Umbraco's way of providing an interface to easily configure it's internal http handler. (i.e. equivilent behavior to response.redirect) that is executed as part of the request handling process (so for every page)
I use it as a rough and ready SEO tool when I need to clear up a load of indexed dead links post site move. The key is that the client does see the 301 as described in my post above.
301 redirect problem
I have a site (Umbraco 4.0.2.1 on Windows 2008 server) where the client asked me to implement a "hard redirect" or 301 redirect, so all visits to domain.dk is redirected to www.domain.dk.
After reading other posts around here i added this to my urlrewriting.config file:
Hi Mikael,
This is "normal" behavior since the idea of the urlrewriting is that you get redirected to another page "behind the scenes" so that it is transparent to the end user.
I think what you have to do is test in your codebehind if the user comes in with the "domain.dk", and in that case do a Response.RedirectPermanent() to the www.domain.dk page.
Cheers,
Michael.
Thank for the answer.
But it would be a little tedious to have code on all the pages checking for "www" and then redirect.
The reason the client want the redirect is that they want their web trafic analisys software to see all traffic as coming to the www.domain.dk page.
Would that work as it i setup now even if the user till see domain.dk ?
The analisys software is using the usual method with some javascript in the mastertemplate
Thanks
Mikael
Hi Mikael,
Try changing redirect="Domain" to redirect="Application" ,
User should see themselves bounced to new domain (i.e. www.domain.dk)
Firebug net panel will also show you that client is receiving the correct status codes. I.e. 301 for domain.dk and then 200 for www.domain.dk (this is good, as it means that google's index will also see it, and only index the www version of the site)
Many Thanks,
Tom
Hi Mikael,
I have unfortunately no idea if it will be picked up as www.domain.dk, but my feeling is that it will not: the urlrewriting is more an internal tool to tell the engine where to actally go look for the data to display, so I don't think that the client gets any information about this.
About the redirect, if should not be so tedious if you have one "root" master template from which all other templates inherit, because then you need to implement the redirect only once in the root template. Also, I am not 100% sure about this, but I think you could actually do the check in the global.asax file (in Application_BeginRequest or something like this).
And once the user has been redirected to www domain, the subsequent links will send it directly to the www.domain.uk page, so the redirect will be performed on the first client request only.
Cheers,
Michael.
@Michael,
urlrewriting.config is Umbraco's way of providing an interface to easily configure it's internal http handler. (i.e. equivilent behavior to response.redirect) that is executed as part of the request handling process (so for every page)
I use it as a rough and ready SEO tool when I need to clear up a load of indexed dead links post site move. The key is that the client does see the 301 as described in my post above.
Many Thanks
Tom
@Tom
Thanks for clearing things out :-)
Cheers,
Michael.
is working on a reply...