htaccess question...
- Started
- Last post
- 8 Responses
- gabriel_pc
I'm trying to create a secure folder on an apache server. Is there anyway to have the username/password info within the htaccess file? Instead of a seperate username/password file?
Thanks!
- ribit0
I think you can..but it isnt very secure...
- gabriel_pc0
my problem is that the only access I have to the server is via ftp and no matter where I put the htpasswd file, it isn't recognised by the htaccess file. any ideas on what might be going on?
- ribit0
normally on a managed server you only have to add the htaccess files where you need them and thats it (assuming the rest is already installed). You need to ask the host where the htpasswd files are already setup.
If it's your server, you can do what yoiu like.
- ribit0
and you need to go into the shell or whatever interface you have and create users and passwords... which get inserted into htpasswd wherever it is.... (I forget though as I'm mainly working on an unmanaged server and we set all this up like 3 years a go and fogot about it...)
- gabriel_pc0
yeah, that's the crappy part, I'm a 3rd party developer so I only have ftp access to the server, no command line access. just trying to figure out if there's a way with just creating and uploading files to lock the folder down.
- ribit0
yep, but you need to put the config files where the program 'htpasswd' is expecting them to be...You need to ask your host.
- ribit0
or more likely, it's all installed, and you just need to know how to add users (a conntrol panel?), and how to reference the config files in yout htaccess file...
- rabattski0
no you can't. however you can have the .htpasswd in the same folder as the .htaccess although it's not really safe. but as long as you use real passwords than it shouldn't be that big of an issue.
what error do you get? i think the most probable cause when .htaccess doesn't work is a wrong path definition (the one in .htaccess which defines where the .htpasswd is). check with your host what that path should be or write a small php script and define a variable as $_SERVER['DOCUMENT_ROOT'] and print_r it. it should show the path the root of the php script.