Forum Moderators: phranque

Message Too Old, No Replies

deny direct access to the folder

         

hotfrost

8:49 pm on Oct 7, 2005 (gmt 0)

10+ Year Member



hello everyone,

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!

jdMorgan

9:26 pm on Oct 7, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



hotfrost,

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

hotfrost

3:16 pm on Oct 10, 2005 (gmt 0)

10+ Year Member



thank you, jdMorgan.

and thanks for welcoming as well..:)