Gossamer Forum
Home : General : Perl Programming :

htaccess: restrict by http_referer AND domain

Quote Reply
htaccess: restrict by http_referer AND domain
I am an htaccess newbie, please help! Even the tutorials are too difficult for me to understand.

I am webmaster of an Air Force site. We are trying to move our users away from the site I maintain and encouraging them to use our new Portal. I'd like to restrict users from viewing my web site unless they are coming from an Air Force Portal URL. At the same time, I do not want to closeout access to those users outside the Air Force who need access but cannot get access through the Air Force Portal. Hope this makes sense.

So in English it would be:

Allow "https://www.afportal.mil" (referring URL)
Allow army.mil (domain)
Allow navy.mil (domain)
Allow .gov (domain)
Deny af.mil AND redirect to "https://www.afportal.mil"
Deny .com AND redirect to "http://www.afpublic.com/"

Could you help me to translate this into real code PLEASE!?
Quote Reply
Re: [TrishD] htaccess: restrict by http_referer AND domain In reply to
My sincere apologies for asking you all to write the code for me. I had no idea where to begin and I couldn't find anything similar in tutorials.
Since then I've found some code similar to what I am trying to do. I've tested out allowing from http_referer but when I test this, it denies access.

SetEnvIf Referer "^https://www7\.my\.af\.mil" allowit
<Limit GET>
Order deny,Allow
deny from all
Allow from allowit
</Limit>


The url I am testing from is https://www7.my.af.mil/gcss-afbvpcp/bvpcp/USAF/ep/home.do?topChannel=default&tabId=1
THANKS!
Crazy