Password Protecting site.com

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 ?

Put the file uploader in its own subfolder and put a password on that?

if theres no other way i could try that… would liek to keep the url as short as possible if i can

give the folder a 1 letter name :smiley:

I would set the folders holding the script and files to 400 or 440 using chmod. Then set up a session on those. On my site, I tell it to look for a session variable, if it isn’t set - remember the url, and redirect to a login page. If the log in is correct, bounce back to the page needing a log in.

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