Forum Moderators: phranque

Message Too Old, No Replies

Restricting access to sites and pages to browsers being referred from

         

Graemezee

2:45 pm on Jul 15, 2009 (gmt 0)

10+ Year Member



I am working on designers website. It has folders containing old redundant website, which he wants to show as part of overall historical marketing schemes.

How can i make the folder (websites) only viewable from the links in the designers project pages. Some of the site have been redesigned and moved on and he would prefer that people not be able to just come across an out dated site

Basically you can only view the pages if you are referred from a specific site is this possible with htaccess.

Some of the sites are complete sites turned off at the moment. Some are just folders on the designers site

Reagards

Graeme

wilderness

10:28 pm on Jul 15, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Refer restrictions are not foolproof.
They'll catch the majority, however will not restrict direct URL requests for the page.

Here's a very old thread [webmasterworld.com].

A search of the archives on "referrer+links [google.com]", provides an abundance of examples and/or methods.

Graemezee

11:27 pm on Jul 16, 2009 (gmt 0)

10+ Year Member



Having followed the links you suggested

I am now trying to get htaccess to limit access to sites and folders unless they come from a particular site.

am trying these mod_setenvif in my htacces files but get an error message which ever way i access the site but getting no joy have tried several options below.

SetEnvIf Referer www.my_site.co.uk OK_allow
....
Allow from env=OK_allow

SetEnvIf Remote_Addr www.my_site.co.uk OK_allow
....
Allow from env=OK_allow

setenvifNoCase referer "^http://www.my_site.co.uk" OK_allow
setenvifNoCase referer "^http://my_site.co.uk" OK_allow
...
<Files ~ "download.html$">
Order Allow,Deny
Allow from env=OK_allow
</Files>

error message

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator

My ISP have suggested

RewriteCond %{HTTP_REFERER} my_site\.co.uk

But they dont seem to really know

jdMorgan

11:44 pm on Jul 16, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Check your server error log, where you will likely find a specific description of the problem.

Note also that literal periods in regular expressions patterns should be escaped, as in "site\.co\.uk"

Your developers will not be able to access these pages unless you also allow blank referrers: By definition, a typed-in URL has no referrer. Unfortunately, this also represents a 'hole' in the protection. As Wilderness stated above, access control by Referer is problematic.

You should use "Order Deny,Allow" and "Deny from All" in addition to your "Allow from env=OK_allow"

See Apache mod_access documentation for a description of Deny,Allow behaviour.

Jim