How do I write a .htaccess file the will redirect if you AREN'T coming from a specific website?
February 16, 2007 8:01 AM Subscribe
How do I write a .htaccess file the will redirect if you AREN'T coming from a specific website?
I want to help my friend promote his services. He will provide a discount to those coming from a link I post on my website, that link will take them to a directory on his website where the prices are discounted. I want to write an htaccess file that makes it to where if you don't have my website or null in your referring header that it redirects you from his special discount directory to the root directory of his website. I've seen examples for blocking specific sites, but not allowing specific sites only.
I want to help my friend promote his services. He will provide a discount to those coming from a link I post on my website, that link will take them to a directory on his website where the prices are discounted. I want to write an htaccess file that makes it to where if you don't have my website or null in your referring header that it redirects you from his special discount directory to the root directory of his website. I've seen examples for blocking specific sites, but not allowing specific sites only.
Referers can be forged, but they can also be blank (if coming from a bookmark, for example), or replaced with all 'X's (by some hardware firewalls), or be the IP address of your server, or be with/without the leading 'www.', or be the 'https:' variant, or any other working alias for the website.
posted by rjt at 10:11 AM on February 16, 2007
posted by rjt at 10:11 AM on February 16, 2007
You could use a server-side or client-side programming on your special page that you want as your referrer on your friends site.
So on yourpage.com/dream (the special page that sends people to your friend.) you could have it automatically send people who goto yourpage.com/dream to friendspage.com/reffered and on yourpage.com/dream you could set a post variable using curl and then check for that on friendspage.com/referred
posted by mrapache at 6:14 AM on March 14, 2007 [1 favorite]
So on yourpage.com/dream (the special page that sends people to your friend.) you could have it automatically send people who goto yourpage.com/dream to friendspage.com/reffered and on yourpage.com/dream you could set a post variable using curl and then check for that on friendspage.com/referred
posted by mrapache at 6:14 AM on March 14, 2007 [1 favorite]
This thread is closed to new comments.
posted by Loser at 9:00 AM on February 16, 2007