Forum Moderators: phranque

Message Too Old, No Replies

Redirecting based on referral website

...questions from a regex newb

         

stuntdubl

4:55 pm on Jan 6, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'm getting serious this time. I've lived without knowing more about mod rewrite for far too long. I am basically clueless in this area, but I've got the fire to learn it now that will hopefully outweigh the frustration. This is just a disclaimer to let ya know I'll be around most likely asking questions often:) Please forgive my lack of understanding with the terminology. I'm really trying to finally wrap my mind around this, and have very limited programming knowledge.

I figure the best way to finally learn is to find relevant applications for use.

Here's my first:

I'd like to redirect requests for my homepage only from a specific referring website to another page on my website transparently.

Legend to understanding my newbie code:
The page I want any redirects from mysite going to - mysite.com/friendsitelandingpage.htm

The site I want to redirect homepage requests from(preferably invisibly
friendsite.com

Here are the couple feeble attempts that I have made thus far:

RewriteCond %{HTTP_REFER} ^www.friendsite.com$ [NC]
RewriteRule ^(.*)$ http: //www.mysite.com/friendsitelandingpage.htm

or something like?

RewriteCond %{HTTP_REFERER} ^http://(www\.)?friendsite\.com/
RewriteRule .*\.$ [mysite.com...] [nc]

Neither of these worked...but I really have no idea...just didn't want folks to think I'm looking to have "my homework done"...really attempting to UNDERSTAND this better, and this is just my first lesson I guess.

Again, my apologies for my cluelessness...but figure I gotta jump in and be a complete newb at some point if I really wanna learn this correctly.

Any learning materials are certainly appreciated as well. I'm interested mainly in referer redirection and and selectively delivering of content, and looking to ease the learning curve, but wrap my mind around the principles through learning by example as well.

jd01

8:39 pm on Jan 6, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Solved this one via messenger.

The answer is:
RewriteCond %{QUERY_STRING} !.
RewriteCond %{HTTP_REFERER} (www\.)?example-friend\.com [NC]
RewriteRule ^(index\.php)?$ /$1?example-page [NC,L]

Justin