DeveloperSide.NET Forums

DeveloperSide.NET => Anything else goes here => Topic started by: Fenwick on September 30, 2005, 09:46:54 AM



Title: Determining a referrer for directory access
Post by: Fenwick on September 30, 2005, 09:46:54 AM
with the use of a .htaccess file in a directory can one specify the exact referrer that gets access, while denying any and all other referrers?


Code:

<Directory />
  Order deny, allow
  Deny from all
  Allow from .domain.com/subdirectory/subdirectory/file.ext
</Directory>


The idea being that only a link from a specific predetermined place within the above sample directive allow access to that directory.

Any advice on the possibility of maybe establishing a "forward" link for all those denied?  In place of an error messge or even a page explaining why the denial other then a default browser error?

Thanks in advance for any input .....


Title: Determining a referrer for directory access
Post by: Jorge on September 30, 2005, 01:15:13 PM
I think mod_rewrite would be better in such a case. I Think it can't be done with just access directives


Title: Determining a referrer for directory access
Post by: Demoric on October 06, 2005, 01:55:31 AM
To my knowledge you can only use just the sitename or IP for that.

E.G.
Allow from SuperFantasticSite.com
Allow From 182.468.128.168

I use something like this:
Code:

#---------- Prevent Bandwidth Thieves by Folder -----------
SetEnvIf REFERER "yoursite\.no-ip\.com" linked_from_here
SetEnvIf REFERER "^$" linked_from_here

<Directory C:/apache2triad/protectedfolder>
    Order deny,allow
    Deny from all
    Allow from env=linked_from_here
</Directory>
## ---------------------------------------------------------