![]() | | ||||||||
| | #1 |
| Advanced Warrior War Room Member Join Date: Nov 2008
Posts: 693
Thanks: 30
Thanked 107 Times in 78 Posts
|
Does anyone know how to write htaccess to deny everyone and allow only certain referrer? I've tried many things and nothing works
|
|
Me
| |
| | |
| | #2 |
| Warrior Nerd Join Date: Nov 2008 Location: SW Florida
Posts: 227
Thanks: 41
Thanked 50 Times in 48 Posts
| Code: RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_REFERER} !^http://(www.)?your_domain.com/ [NC]
RewriteCond %{HTTP_REFERER} !^http://(www.)?gooddomain.com/ [NC]
RewriteCond %{HTTP_REFERER} !^http://gooddomain.com/ [NC]
RewriteRule ^.*$ http://yourdomain.com/notallowed.html [R=301,L] I think you'll need to include your own domain or it may not work. Untested, but I think it will work. Keep in mind that some people/programs block referer by default (I think Norton does) so you might also need a blank referer. It SHOULD redirect anything not equal to those referrers. Method 2 Have the index be your 'everyone else' page Code: RewriteBase /
RewriteCond %{HTTP_REFERER} ^http://(www.)?your_domain.com/ [NC]
RewriteCond %{HTTP_REFERER} ^http://(www.)?gooddomain.com/ [NC]
RewriteRule ^.*$ http://yourdomain.com/yourprivatesalespage.html [R=301,L] |
|
Cheers, Kathy | |
| | |
| | #3 | |
| Advanced Warrior War Room Member Join Date: Nov 2008
Posts: 693
Thanks: 30
Thanked 107 Times in 78 Posts
| Quote:
Thank you so much. I really like the second idea. The first version looks familiar like I've tried it before, but the second one is an excellent idea. I haven't thought of it before. My IT guy writes some complicated PHP code for me whereas the download page is a temp file authomatically generated after receiving payment confirmation and only works for one IP address and only for two hours, but it was too complicated for me to understand plus I always had to contact him for support. With htaccess I can set up my thank you page myself. Thanks again! | |
|
Me
| ||
| | |
| | #4 |
| Active Warrior War Room Member Join Date: Dec 2004 Location: , , .
Posts: 41
Thanks: 4
Thanked 6 Times in 4 Posts
|
Yeah I've always used that first example. Got it from a google search awhile back.
|
| | |
![]() |
|
| Tags |
| apache, htaccess, question |
| Thread Tools | |
| |
![]() |