...

View Full Version : Password Protecting site.com



efhx
03-16-2011, 05:10 PM
I downloaded a file uploader to use on my website so I have my own personal file uploading service for my files so I dont have to worry about any being removed but I dont want it to be usable by the public which is why I would like to add a password to it.. I tried doing it with .htaccess and .htpasswd by using this:

AuthName "Restricted Area"
AuthType Basic
AuthUserFile /home/efhx/.htpasswd
AuthGroupFile /dev/null
<Files *.php>
require valid-user
</Files>
<Files *.js>
require valid-user
</Files>

for some reason, I can get it to work if it requires authentication for every single file/folder on the website but I cant get it to work with just php,js files.. so I'm looking for alternative ways. Is there anything I can do to make site.com password protected but the public would be able to view all my other folders like site.com/images ?

Fou-Lu
03-16-2011, 10:29 PM
This doesn't have anything to do with PHP, moving to apache configurations.

It doesn't look wrong, but I can't be 100% sure that the authtype works outside of the files block. Seems logical to me that it would. You can try this instead, and see how it works (I'm lazy, so I'll just use a filematch):


<FilesMatch "\.(php|js)$">
AuthName "Restricted Area"
AuthType Basic
AuthUserFile /home/efhx/.htpasswd
Require valid-user
</FilesMatch>

efhx
03-17-2011, 02:16 AM
finally figured it out.. there was a blank space after htpasswd and some of the other lines.. got rid of them and it worked :thumbsup: thanks for the help



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum