Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am not being paid for this and I would like to know the quickest way to do the following. A former client has a page which only members can access. This page links to a number of galleries which he only wants members to access. The galleries are not protected by any kind of authentication.

What I assume is the quickest way to do this is to create a .htaccess file which only allow people to view the site when the come from a certain referrer. Would this work?

My current thinking is that I could use a php script to deploy a .htaccess file into each of the gallery directories. (There are around a 100 at the moment.)

I found this link which might be what I am after but to be honest I really don't get it. Is my thinking sound?

share|improve this question
3  
Heck, we're not being paid for this, either. –  pavium Feb 2 '10 at 11:13
    
Was just looking for a point in the right direction. I figured someone would have a bookmark that they could share... –  JasonS Feb 3 '10 at 9:02

3 Answers 3

If you are willing to go down the PHP road why not consider recommending an existing gallery application like Gallery2 or Coppermine, or building some basic authentication with cookies to manage access?

share|improve this answer

Yes, using a .htaccess file is a good idea, but making exceptions for all of the IP addresses and/or URLs that his members could possibly come from is going to be a pain.

Just tell him to have them use a password, and setup the .htaccess file in conjunction with a .htpasswd file.

.htaccess How-To on Apache.org

.htpasswd on Apache.org

share|improve this answer

What I assume is the quickest way to do this is to create a .htaccess file which only allow people to view the site when the come from a certain referrer. Would this work?

Not always, no. Not all browsers submit the HTTP Referer field, and some firewalls even remove it. Your biggest issue will be that, if you add it, you'll get sporadic complaints and that'll be hard to investigate unless you have logs to hand that include the referring page.

This page links to a number of galleries which he only wants members to access.

However you verify if a user is a member, is how you protect your gallery.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.