cancel
Showing results for 
Search instead for 
Did you mean: 

htaccess htpasswd not working on php files?

ninjanik
Newbie
Posts: 9
Registered: ‎03-08-2007

htaccess htpasswd not working on php files?

Hi,
I've followed the tutorial on: http://usertools.plus.net/tutorials/id/5 for setting up password protection on folders, but it doesn't seem to work when you request an actual php file.
i.e. request a php file from a protected directory and the user/pwd prompt appears. Click cancel on the prompt and the requested php file is executed and displayed. However if it is a plain txt or config.ini type file then the protection works as expected.
Is there something im missing here.. is there something that needs configuration by plusnet?Huh
Really need some advice on this one... have spent all day on it so far!
thanks.
3 REPLIES 3
Peter_Vaughan
Grafter
Posts: 14,469
Registered: ‎30-07-2007

Re: htaccess htpasswd not working on php files?

You are correct, you cannot protect .php files with .htaccess/.htpasswd.
This is because the ccgi server runs the php interpreter in cgi mode and not as an apache module so the php file is read before apache reads the .htaccess file.
There is no way around it.
ninjanik
Newbie
Posts: 9
Registered: ‎03-08-2007

Re: htaccess htpasswd not working on php files?

Thanks for the confirmation mate  Smiley
i can stop wasting my time now!!
Liam
Grafter
Posts: 2,083
Registered: ‎04-04-2007

Re: htaccess htpasswd not working on php files?

When we come to redesigning CGI in the not *too* distant future, it is likely that we will revisit this.