Added pwd protecting file(s)

More styling in Contributing.md
This commit is contained in:
An Phan 2015-01-27 18:37:22 +08:00
parent e61dbb9892
commit c6711a5986
2 changed files with 38 additions and 0 deletions

View File

@ -10,6 +10,7 @@
## Styling
- Put your snippets into corresponding sections.
- Put the snippet names into the [Table of Contents](README.md#table-of-contents) and link them using relative URLs.
- Use `###` headers for your snippets.
- Add some note/description if applicable. People will thank you for that.
- Be grateful. Indicate a source using this format `[Source](link)` if applicable.

View File

@ -5,9 +5,31 @@ A collection of useful .htaccess, all in one place. I decided to create this rep
## Table of Contents
- [Rewrite and Redirection](#rewrite-and-redirection)
- [Force www](#force-www)
- [Force www in a Generic Way](#force-www-in-a-generic-way)
- [Force non-www](#force-non-www)
- [Force HTTPS](#force-https)
- [Force Trailing Slash](#force-trailing-slash)
- [Redirect a Single Page](#redirect-a-single-page)
- [Redirect an Entire Site](#redirect-an-entire-site)
- [Security](#security)
- [Deny All Access](#deny-all-access)
- [Deny All Access Except Yours](#deny-all-access-except-yours)
- [Allow All Access Except Spammers'](#allow-all-access-except-spammers)
- [Deny Access to Hidden Files and Directories](#deny-access-to-hidden-files-and-directores)
- [Disable Directory Browsing](#disable-directory-browsing)
- [Disable Image Hotlinking](#disable-image-hotlinking)
- [Password Protect a Directory](#password-protect-a-directory)
- [Password Protect a File or Several Files](#password-protect-a-file-or-several-files)
- [Performance](#performance)
- [Compress Text Files](#compress-text-files)
- [Set Expires Headers](#set-expires-headers)
- [Turn eTags Off](#turn-etags-off)
- [Miscellaneous](#miscellaneous)
- [Set PHP Variables](#set-php-variables)
- [Custom Error Pages](#custom-error-pages)
- [Force Downloading](#force-downloading)
- [Allow Cross-Domain Fonts](#allow-cross-domain-fonts)
## Rewrite and Redirection
Note: It is assumed that you have `mod_rewrite` installed and enabled.
@ -123,6 +145,21 @@ AuthUserFile /home/fellowship/.htpasswd
Require valid-user
```
### Password Protect a File or Several Files
``` apacheconf
AuthName "One still does not simply"
AuthType Basic
AuthUserFile /home/fellowship/.htpasswd
<Files "one-ring.o">
Require valid-user
</Files>
<FilesMatch ^((one|two|three)-rings?\.o)$>
Require valid-user
</FilesMatch>
```
## Performance
### Compress Text Files
``` apacheconf