htaccess password

Most websites are to be shown to the public however its possible there maybe some links from the main website which you may wish to secure such as: By default the browser will show it as a folder listing or a website if there is an index.php file.

To secure the link we can use htaccess which will prompt a password before the content is showed. We can do this at:


	<Directory "/var/www/html/secureStuff>
	AuthName "Restricted Access"
	AuthType Basic
	AuthUserFile /etc/apache2/.htaccess
	Require valid-user

The code will prompt for a username a password defined by the AuthUserFile. The location in which it will ask from will be /var/www/html. This is the default root location for the main website. = /var/www/html = /var/www/html/secureStuff
For the password itself it would be made with: sudo htpasswd -c /etc/apache2/.htaccess username