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.
posted by torpark to computers & internet (4 comments total)
1 user marked this as a favorite
SetEnvIfNoCase Referer "^http://www.your-domain-name-here.com/" locally_linked=1
Order Allow,Deny
Allow from env=locally_linked
You may also want to consider using .htaccess password protection with an .htpasswd file. You could just provide the username and password on your site and then protect the entire directory on his site with that same combination. If for some reason people are blocking referers, or copy and paste the link from your site to his, they'd still be able to get to the special area.
posted by odinsdream at 8:50 AM on February 16, 2007