Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.htpasswd path in .htaccess file

My .htpasswd file is in 'www' folder in wamp. My .htaccess file is also in same 'www' folder.I want to set path for .htpasswd in .htaccess file. How to set path in AuthUserFile

AuthName "Restricted Area" 
AuthType Basic 
AuthUserFile www/.htpasswd    **path incorrect
AuthGroupFile /dev/null 
require valid-user
like image 733
user3386779 Avatar asked Sep 11 '25 20:09

user3386779


1 Answers

You must use the full path to your .htpasswd file.

Create a .php file in the same folder, containing the following code :

<?php
echo dirname(__FILE__) . '/.htpasswd';
?>

Then access it via your browser and it should display the full path you'll need to put in your .htaccess file.

like image 140
roberto06 Avatar answered Sep 14 '25 11:09

roberto06