logo
down
shadow

Only password protect one file in folder with .htaccess


Only password protect one file in folder with .htaccess

By : Tobias Bylund
Date : November 22 2020, 07:01 PM
seems to work fine Let's say you want to password protect your secret.html file. Just create a .htaccess file in the same folder as the secret file, with the following content (you may need to customize some values according to your config:
code :


Share : facebook icon twitter icon
.htaccess password protect directory but allow image file types

.htaccess password protect directory but allow image file types


By : user3353778
Date : March 29 2020, 07:55 AM
To fix the issue you can do I need to password protect a directory with .htaccess, which I have successfully done. But the front end of the website was programmed to link to images within this password protected directory (not by me), but when a webpage tries to access those images it prompts the user to login.
code :
AuthName "Secure Area"
AuthUserFile "/home/siteuser/.htpasswds/public_html/admin/passwd"
AuthType Basic
require valid-user
<FilesMatch "\.(png|jpe?g|gif)$">
  Satisfy Any
  Allow from all
</FilesMatch>
.htaccess password protect directories with no index file

.htaccess password protect directories with no index file


By : Raza Hasan
Date : March 29 2020, 07:55 AM
Hope this helps I have figured it out how to do it! :D
First Put in a PHP-generated directory for those without any index page:
code :
DirectoryIndex default.php index.php index.html /php_directory.php
AuthUserFile /full/path/here/.htpasswd
AuthType Basic
AuthName "Log in"
Error while trying to password protect .htaccess file

Error while trying to password protect .htaccess file


By : Jurek Oleksiewicz
Date : March 29 2020, 07:55 AM
it should still fix some issue Just for testing purpose I am trying my .htaccess file to be password protected on localhost. , Finally it worked for me The code in .htaccess file was as following.
code :
AuthName "Restricted Area" 
AuthType Basic 
AuthUserFile /wamp/www/mypass/.htpasswd    
require valid-user
Password protect a folder and website shown on subdomain without dropping a file inside that folder

Password protect a folder and website shown on subdomain without dropping a file inside that folder


By : Chris C
Date : March 29 2020, 07:55 AM
I hope this helps . You have two options:
Put the rules in your main Apache config Update your cloning process to ignore .htaccess files
password protect a single file using .htaccess

password protect a single file using .htaccess


By : Paolo Tabaroni
Date : March 29 2020, 07:55 AM
Any of those help I have tried to password protect a single file using .htaccess. But when accessing the file the browser just redirects to the home page of the website. I have my .htpasswd on my webroot. My .htaccess file is given below
shadow
Privacy Policy - Terms - Contact Us © 35dp-dentalpractice.co.uk