Forum Moderators: phranque
goal:
deny direct access to the folder and files in it,
except when the user requests it browsing my www.mysite.com site.
how to achieve it?
I have played with:
RewriteCond %{HTTP_REFERER}!^www.mysite\.com.*$ [NC]
#RewriteRule .* - [F]
the thing is, i can't write the rule propertly:
"if referer is NOT www.mysite.com then deny access"..
or i could ask for the opposite:
"if referer is www.mysite.com then allow access"..
looking for help here...thank you!
Welcome to WebmasterWorld!
You've got the rule itself commented-out. The proper syntax for your rule would be:
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_REFERER} .
RewriteCond %{HTTP_REFERER} !^(www\.)?mysite\.com [NC]
RewriteRule .* - [F]
However, access control by referrer is unreliable for several reasons. See my comments about blank referrers in this recent thread [webmasterworld.com].
Jim