O'Reilly logo

Joomla! Web Security: Secure your Joomla! Website from Common Security Threats with this easy-to-use Guide by Tom Canavan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

List of Critical Settings

Following is the list of critical settings regarding .htaccess and php.ini files:

.htaccess

Rule one: Password-protect a single file.

# password-protect single file
<Files secure.php>
 AuthType Basic
 AuthName "Prompt"
 AuthUserFile /home/path/.htpasswd
 Require valid-user
</Files>

Rule two: Use FilesMatch to password-protect multiple files.

# password-protect multiple files
<FilesMatch "^(execute|index|secure|insanity|biscuit)*$">
 AuthType basic
 AuthName "Development"
 AuthUserFile /home/path/.htpasswd
 Require valid-user
</FilesMatch>

Rule three: Password-protect a directory, in this case the one containing .htaccess.

# password-protect the directory in which this .htaccess rule resides AuthType basic AuthName "This directory ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required