I'd say that if it's an option, you can use ISAPI re-write to send
domains.com users to domain.com.  That is probably more efficient than
having CF do it.

But, if that's not an option for you, I'd put it in onRequestStart instead.
If it's onSessionStart and, for some reason, you happen to have a link
inadvertently pointing to domains.com, the user won't get redirected
(because their session already has started). [or, if you have a user who
insists on changing the URL again to domains.com]

It does add a little overhead on every request, but it's more likely to
ensure the user stays on domain.com

Scott

On Thu, Jun 3, 2010 at 9:06 AM, Che Vilnonis <[email protected]> wrote:

>
> Here is the scenario. I own a domain. Call it domain.com. I also own an
> often misspelled version, domains.com. Note the extra 's'.
> I'd like to have domain.com automatically redirect to www.domain.com.
> I'd also like have the www.domains.com or domains.com automatically
> redirect
> to www.domain.com.
> I'm using IIS6.
>
> Anyway, I'm using the following code in onSessionStart:
>
> <!--- domain redirects. --->
> <cfif cgi.server_name eq "http://domain.com"; or cgi.server_name contains
> "domains.com">
>        <cfheader statuscode="301" statustext="Moved permanently">
>        <cfheader name="Location" value="http://www.domain.com";>
> </cfif>
>
> It seems to work. But I have a few questions.
>
> 1. Is onSessionStart the best place to put this code?
> 2. Should I be doing this type of redirect in IIS 6 instead of CF? If so,
> how?
> 3. Are the any search engine related "penalties" to doing any of these
> redirects?
>
> Thanks, Che
>
>
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:334255
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to