homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

rewrite based on referrer?

10+ Year Member

Msg#: 65 posted 2:23 am on Dec 8, 2002 (gmt 0)

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!?



WebmasterWorld Senior Member 10+ Year Member

Msg#: 65 posted 12:28 pm on Dec 8, 2002 (gmt 0)

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.


10+ Year Member

Msg#: 65 posted 3:29 pm on Dec 8, 2002 (gmt 0)

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...

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved