Koozali.org: home of the SME Server

Password protect single files instead of directories *SOLVED*

Offline Emilio_k

  • 2
  • +0/-0
Password protect single files instead of directories *SOLVED*
« on: February 22, 2012, 10:40:00 AM »
Hi,

I have been able to password protect a directory on my website using the 50AddSecureIbayFolder in my httpd.conf:

<Directory /home/e-smith/files/ibays/Primary/html/links/admin>
AuthUserFile /etc/htpasswd
AuthName "admin links"
AuthType Basic
<Limit GET>
order deny,allow
require user admin
</Limit>
</Directory>


But how do I would also like to password protect a single page (a .php file in this case).
Does anyone know how to do this?

Thanks.

« Last Edit: February 22, 2012, 01:20:11 PM by Emilio_k »

Offline Stefano

  • *
  • 10,894
  • +3/-0
Re: Password protect single files instead of directories
« Reply #1 on: February 22, 2012, 11:40:15 AM »
does apache have such a feature? if so, find how, then you're done..

Offline mmccarn

  • *
  • 2,656
  • +10/-0
Re: Password protect single files instead of directories
« Reply #2 on: February 22, 2012, 12:33:37 PM »
Put it in a directory and protect that? (maybe with a symlink at the old location, ans FollowSymLins turned on)

Offline Emilio_k

  • 2
  • +0/-0
Re: Password protect single files instead of directories
« Reply #3 on: February 22, 2012, 01:19:24 PM »
Ah,

<Directory /home/e-smith/files/ibays/Primary/html/links/admin>
AuthUserFile /etc/htpasswd
AuthName "admin links"
AuthType Basic
<Files admin.php>
require user admin
</Files>
</Directory>


seems to work :)