Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

.htaccess: restrict by HTTP_Referer AND Domain

Status
Not open for further replies.

TrishaD

Programmer
Mar 16, 2004
2
US
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 " (referring URL)
Allow army.mil (domain)
Allow navy.mil (domain)
Allow .gov (domain)
Deny af.mil AND redirect to "Deny .com AND redirect to "
Could you help me to translate this into real code PLEASE!?
 
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 "^ allowit

<Limit GET>
Order deny,Allow
deny from all
Allow from allowit
</Limit>

The url I am testing from is
THANKS!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top