Welcome to WebmasterWorld Guest from 3.227.3.146

Forum Moderators: Ocean10000 & 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)

Inactive Member
Account Expired

 
 


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.

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

Senior Member

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Mar 31, 2002
posts:25430
votes: 0


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