Help - Redirect doesn't work

223 views
Skip to first unread message

Risto

unread,
Jun 22, 2010, 12:06:56 PM6/22/10
to ColdFusion on Wheels
Hi,

Does anyone have more than 1 url pointing to the same wheels site?

For example, my wheels site is www.abc.com.

I also have www.zzz.com that points to the same site.

I want to do a redirect to www.abc.com if they come in from www.zzz.com.

Here is a snippet.

<cfif CGI.SERVER_NAME is " www.abc.com" >
<!--- don't do anything, stay on the site --->
<cfelse>
<!--- any other domain redirect to www.abc.com --->
<cfif CGI.SERVER_PORT is 80 AND CompareNoCase( CGI.REQUEST_METHOD ,
"get") is 0 >
<!--- <cfheader statuscode="301" statustext="Moved permanently"> --->
<cfif CGI.QUERY_STRING IS NOT "" >
<cfheader name="Location" value="http://www.abc.com/?
#CGI.QUERY_STRING#">
<cfelse>
<cfheader name="Location" value="http:/www.abc.com">
</cfif>
</cfif>

What it redirects to is http://www.zzz.com/www.abc.com/rewrite.cfm

Then I put the code in Onrequeststart and it went to
http://www.zzz.com/www.abc.com,www.abc.com

???

I'm at a loss, I'm hoping I'm not the only one who's ever had more
than one url point to the same site.

I am using URLrewriting on IIS7. Using the default web.config in
wheels.

Thanks


</cfif>

Per Djurner

unread,
Jun 22, 2010, 12:17:11 PM6/22/10
to cfwh...@googlegroups.com
Should you not be using cflocation instead?
http://www.cfquickdocs.com/cf8/?getDoc=cflocation

> --
> You received this message because you are subscribed to the Google Groups "ColdFusion on Wheels" group.
> To post to this group, send email to cfwh...@googlegroups.com.
> To unsubscribe from this group, send email to cfwheels+u...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/cfwheels?hl=en.
>
>

Andy Bellenie

unread,
Jun 22, 2010, 12:18:40 PM6/22/10
to cfwh...@googlegroups.com
cflocation uses the header code for a temporary redirect, which may not be what Risto is after.

have you considered changing the domain for www.zzz.com to forward requests to www.aaa.com instead?

Per Djurner

unread,
Jun 22, 2010, 12:21:40 PM6/22/10
to cfwh...@googlegroups.com
You can use the "statusCode" argument to pass in any code though.

Risto

unread,
Jun 22, 2010, 12:27:56 PM6/22/10
to ColdFusion on Wheels
Hi,

We need to append unique tracking code to the urls.

I don't think that can be done with dns.

Thanks for the quick responses


On Jun 22, 12:18 pm, Andy Bellenie <andybelle...@gmail.com> wrote:
> cflocation uses the header code for a temporary redirect, which may not be
> what Risto is after.
>
> have you considered changing the domain forwww.zzz.comto forward requests
> towww.aaa.cominstead?
>
> On 22 June 2010 17:17, Per Djurner <per.djur...@gmail.com> wrote:
>
>
>
> > Should you not be using cflocation instead?
> >http://www.cfquickdocs.com/cf8/?getDoc=cflocation
>
> > On Tue, Jun 22, 2010 at 6:06 PM, Risto <ck.webser...@gmail.com> wrote:
> > > Hi,
>
> > > Does anyone have more than 1 url pointing to the same wheels site?
>
> > > For example, my wheels site iswww.abc.com.
>
> > > I also havewww.zzz.comthat points to the same site.
>
> > > I want to do a redirect towww.abc.comif they come in fromwww.zzz.com.
>
> > > Here is a snippet.
>
> > > <cfif CGI.SERVER_NAME is "www.abc.com" >
> > > <!--- don't do anything, stay on the site --->
> > > <cfelse>
> > > <!--- any other domain redirect towww.abc.com--->
> > > <cfif CGI.SERVER_PORT is 80 AND CompareNoCase(  CGI.REQUEST_METHOD ,
> > > "get") is 0 >
> > > <!--- <cfheader statuscode="301" statustext="Moved permanently"> --->
> > > <cfif CGI.QUERY_STRING IS NOT "" >
> > >                <cfheader name="Location" value="http://www.abc.com/?
> > > #CGI.QUERY_STRING#">
> > > <cfelse>
> > >                <cfheader name="Location" value="http:/www.abc.com">
> > >        </cfif>
> > > </cfif>
>
> > > What it redirects to ishttp://www.zzz.com/www.abc.com/rewrite.cfm
>
> > > Then I put the code in Onrequeststart and it went to
> > >http://www.zzz.com/www.abc.com,www.abc.com
>
> > > ???
>
> > > I'm at a loss, I'm hoping I'm not the only one who's ever had more
> > > than one url point to the same site.
>
> > > I am using URLrewriting on IIS7. Using the default web.config in
> > > wheels.
>
> > > Thanks
>
> > > </cfif>
>
> > > --
> > > You received this message because you are subscribed to the Google Groups
> > "ColdFusion on Wheels" group.
> > > To post to this group, send email to cfwh...@googlegroups.com.
> > > To unsubscribe from this group, send email to
> > cfwheels+u...@googlegroups.com<cfwheels%2Bunsubscribe@googlegroups.c om>
> > .
> > > For more options, visit this group at
> >http://groups.google.com/group/cfwheels?hl=en.
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "ColdFusion on Wheels" group.
> > To post to this group, send email to cfwh...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > cfwheels+u...@googlegroups.com<cfwheels%2Bunsubscribe@googlegroups.c om>
> > .

joshua clingenpeel

unread,
Jun 22, 2010, 12:22:03 PM6/22/10
to cfwh...@googlegroups.com
I'd either do what Andy says, or in IIS7 set up www.zzz.com as its own
website and forward all requests to the same page in www.abc.com - I
know how to do this in IIS6.

--
Josh

tpet...@gmail.com

unread,
Jun 22, 2010, 1:26:19 PM6/22/10
to ColdFusion on Wheels
you can do this from within the iis7 rewriter. here is a blog post
that explains the setup:

http://weblogs.asp.net/owscott/archive/2009/11/30/iis-url-rewrite-redirect-multiple-domain-names-to-one.aspx

On Jun 22, 12:06 pm, Risto <ck.webser...@gmail.com> wrote:
> Hi,
>
> Does anyone have more than 1 url pointing to the same wheels site?
>
> For example, my wheels site iswww.abc.com.
>
> I also havewww.zzz.comthat points to the same site.
>
> I want to do a redirect towww.abc.comif they come in fromwww.zzz.com.
>
> Here is a snippet.
>
> <cfif CGI.SERVER_NAME is "www.abc.com" >
> <!--- don't do anything, stay on the site --->
> <cfelse>
> <!--- any other domain redirect towww.abc.com--->
> <cfif CGI.SERVER_PORT is 80 AND CompareNoCase(  CGI.REQUEST_METHOD ,
> "get") is 0 >
> <!--- <cfheader statuscode="301" statustext="Moved permanently"> --->
> <cfif CGI.QUERY_STRING IS NOT "" >
>                 <cfheader name="Location" value="http://www.abc.com/?
> #CGI.QUERY_STRING#">
> <cfelse>
>                 <cfheader name="Location" value="http:/www.abc.com">
>         </cfif>
> </cfif>
>
> What it redirects to ishttp://www.zzz.com/www.abc.com/rewrite.cfm
>
> Then I put the code in Onrequeststart and it went tohttp://www.zzz.com/www.abc.com,www.abc.com

Risto

unread,
Jun 22, 2010, 1:57:37 PM6/22/10
to ColdFusion on Wheels
Hi,

I'd like to thank everyone for their help.

I ended up using the cflocation with the status code that Per
suggested.

My problem amounted to the fact that this client has close to 50 urls!
Our seo guy want's us to append unique tracking code
depending on which site they come from.

For this reason the IIS redirect and the web.config in the URL rewrite
won't work. But I'm glad you guys told me, because that is
my normal scenario and I will definitely be doing it that way from now
on.

Thanks again.




On Jun 22, 1:26 pm, "tpetru...@gmail.com" <tpetru...@gmail.com> wrote:
> you can do this from within the iis7 rewriter. here is a blog post
> that explains the setup:
>
> http://weblogs.asp.net/owscott/archive/2009/11/30/iis-url-rewrite-red...
>
> On Jun 22, 12:06 pm, Risto <ck.webser...@gmail.com> wrote:
>
> > Hi,
>
> > Does anyone have more than 1 url pointing to the same wheels site?
>
> > For example, my wheels site iswww.abc.com.
>
> > I also havewww.zzz.comthatpoints to the same site.
>
> > I want to do a redirect towww.abc.comifthey come in fromwww.zzz.com.
Reply all
Reply to author
Forward
0 new messages