FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


protecting a file with htaccess





arch23
I'm trying to protect a file in my root dir with htaccess and htpasswd.
this is my htaccess file:
Code:

<files "admin.php">
AuthName "username"
AuthType Basic
AuthUserFile /domains/mydomain.com/public_html/.htpasswd
require valid-user
</files>


this is my htpasswd:
Code:

username:enctyptedpass


I get the prompt when I try to access the file, but the username and pass I enter just doesn't work. I suspect it's the path of the .htpasswd
Any idea?
Thanks
thiamshui
U can protect the file easily and faster in DirectAdmin..
arch23
DirectAdmin will only let me protect directories, unless I've missed something.
ml
for unix systems you'll have to crypt the password in the .htpasswd file.
it can be done with htpasswd.exe thats located in a standard apache2 installation in the bin directory
arch23
the file is crypted, I used an online web utility for that. How does it decrypt?
foggy
Try prepending /home/username/ onto the path to your .htpasswd file. Replace "username" with the username for your hosting account.
arch23
I hope i got you right... I changed my htaccess to:
Code:

<files "admin.php">
AuthName "myusername"
AuthType Basic
AuthUserFile /home/myusername/.htpasswd
require valid-user
</files>


still doesn't work.
PatTheGreat42
Are you sure you're entering in your information completely correctly? I couldn't log onto one of my accounts for a while because I was entering "PatTheGreat" instead of "patthegreat" as my username. Check captilization and such; it could matter a lot.
Stubru Freak
I would use DirectAdmin to protect the directory, then edit the file a little bit to make it protect a file.
arch23
I can't see or edit the .htaccess file the direct admin creates. Also, it doesn't seem to create an .htpasswd file.
yosefa
thiamshui wrote:
U can protect the file easily and faster in DirectAdmin..

How to protect the file in DirectAdmin?
Related topics
.htaccess tutorial
How to make a symlink
.htacess in phpBB ?
WordPress Glitch
.htaccess instead of mod_rewrite
question about .htaccess mod_python with publisher mod
htaccess
General .htaccess tutorial.
Permission denied! Can't access DirectAdmin at :2222 Help!!!
Help with Drupal on Frihost (CleanURLs)
.htaccess file and 404 error
Seven Elements of a Successful Web Presence
You don't have permission to access / on this server.
May I ask to enable or load the apache module
New Joomla User
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.