Forum Moderators: phranque

Message Too Old, No Replies

htaccess for php file

passwd protect page called by php script

         

gavinh65

5:03 pm on Dec 13, 2003 (gmt 0)



I have php scripts which dynamically generate my website "catalog". I want to limit user access to detailed product info from my catalog, but allow viewing of thumb images. I have a htpasswd file that works for my user list. I have tried the following htaccess config:

AuthUserFile secure/.htpasswd
AuthName Authorized User
AuthType Basic

<Files pop.php>
require valid-user
</Files>

This returns a 403 error at the point I want the user/passwd request to come up. This pop.php file is only read to display the content I want to restrict. the pop.php file is called using href with arguments from another file called catalogue.php

How do I get the user/passwd to display? Any help much appreciated.

jdMorgan

9:33 pm on Dec 13, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hmmm...

Two things to check:

The AuthUserFile path doesn't look right. It is usually a full path from root (/) to the file, like

 AuthUserFile /u/httpd/web/secure/.htpasswd 

Also, you can cut the problem in half... Make a simple html page protected by your password-related code, and use that to get authorization working without all the complexities of actually running the script. Once that works, change the <Files> directive to protect the script instead.

Jim