Welcome to WebmasterWorld Guest from

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

rewrite based on referrer?

2:23 am on Dec 8, 2002 (gmt 0)

10+ Year Member

Can something like this be done?

This script is in the .htaccess file of mydomain.com

RewriteCond %{HTTP_REFERER}!http://refer.ccbill.com/.*$
RewriteRule ^index\.php$ [refer.ccbill.com...] [R,L]

Basically, I want to rewrite the default index file such that it is passed to the click code, which encodes the return URL as the mydomain.com. THe second time around, the rewrite engine would detect the referer was from ccbill, and not rewrite the index file the second time, but allow it to execute normally.

Is this even in the realm of possibility or wishful thinking!?

12:28 pm on Dec 8, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member

I think something along these lines could be made to work. Why not try it? Simply substitute another domain that you can access for refer.ccbill for test and refining purposes and let us know how it works.
3:29 pm on Dec 8, 2002 (gmt 0)

10+ Year Member

The real problem I have is I need a RewriteOnce condition because I want to rewrite to an external URL and that come back to the same directory and index file as what the user came to my site. I.e. access mydomain.com ==> forward to external link ===> return to mydomain.com/ (without any file specified) so basically the rewrite must occur once for the directory/index file, how can this be achieved, everything I've seen on the net, php, etc.. can only do it once IF you have cookies, I need a non-cookie solution nor by passing anything on the URL string...That's why I thought about the referer, but this is not always passed either...