mirror of
https://github.com/phanan/htaccess.git
synced 2018-11-08 13:39:40 +01:00
Merge branch 'rez0n-master'
This commit is contained in:
commit
5b83526e12
22
README.md
22
README.md
@ -31,6 +31,7 @@ What we are doing here is mostly collecting useful snippets from all over the in
|
|||||||
- [Deny Access to Backup and Source Files](#deny-access-to-backup-and-source-files)
|
- [Deny Access to Backup and Source Files](#deny-access-to-backup-and-source-files)
|
||||||
- [Disable Directory Browsing](#disable-directory-browsing)
|
- [Disable Directory Browsing](#disable-directory-browsing)
|
||||||
- [Disable Image Hotlinking](#disable-image-hotlinking)
|
- [Disable Image Hotlinking](#disable-image-hotlinking)
|
||||||
|
- [Disable Image Hotlinking for Specific Domains](#disable-image-hotlinking-for-specific-domains)
|
||||||
- [Password Protect a Directory](#password-protect-a-directory)
|
- [Password Protect a Directory](#password-protect-a-directory)
|
||||||
- [Password Protect a File or Several Files](#password-protect-a-file-or-several-files)
|
- [Password Protect a File or Several Files](#password-protect-a-file-or-several-files)
|
||||||
- [Performance](#performance)
|
- [Performance](#performance)
|
||||||
@ -228,9 +229,28 @@ Options All -Indexes
|
|||||||
### Disable Image Hotlinking
|
### Disable Image Hotlinking
|
||||||
``` apacheconf
|
``` apacheconf
|
||||||
RewriteEngine on
|
RewriteEngine on
|
||||||
|
# Remove the following line if you want to block blank referrer too
|
||||||
RewriteCond %{HTTP_REFERER} !^$
|
RewriteCond %{HTTP_REFERER} !^$
|
||||||
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?yourdomain.com [NC]
|
|
||||||
|
RewriteCond %{HTTP_REFERER} !^http(s)?://(.+\.)?yourdomain.com [NC]
|
||||||
|
RewriteRule \.(jpg|jpeg|png|gif|bmp)$ - [NC,F,L]
|
||||||
|
|
||||||
|
# If you want to display a "blocked" banner in place of the hotlinked image,
|
||||||
|
# replace the above rule with:
|
||||||
|
# RewriteRule \.(jpg|jpeg|png|gif|bmp) http://yourdomain.com/blocked.png [R,L]
|
||||||
|
```
|
||||||
|
|
||||||
|
### Disable Image Hotlinking for Specific Domains
|
||||||
|
Sometimes you want to disable image hotlinking from some bad guys only. The following snippet should help you with that.
|
||||||
|
``` apacheconf
|
||||||
|
RewriteEngine on
|
||||||
|
RewriteCond %{HTTP_REFERER} ^http(s)?://(.+\.)?badsite\.com [NC,OR]
|
||||||
|
RewriteCond %{HTTP_REFERER} ^http(s)?://(.+\.)?badsite2\.com [NC,OR]
|
||||||
RewriteRule \.(jpg|jpeg|png|gif)$ - [NC,F,L]
|
RewriteRule \.(jpg|jpeg|png|gif)$ - [NC,F,L]
|
||||||
|
|
||||||
|
# If you want to display a "blocked" banner in place of the hotlinked image,
|
||||||
|
# replace the above rule with:
|
||||||
|
# RewriteRule \.(jpg|jpeg|png|gif|bmp) http://yourdomain.com/blocked.png [R,L]
|
||||||
```
|
```
|
||||||
|
|
||||||
### Password Protect a Directory
|
### Password Protect a Directory
|
||||||
|
Loading…
Reference in New Issue
Block a user