mirror of https://github.com/phanan/htaccess.git
Compact patterns for matching images
Trim trailing white spaces
This commit is contained in:
parent
edd093473e
commit
6e3ca17b74
14
README.md
14
README.md
|
@ -242,25 +242,25 @@ RewriteEngine on
|
|||
# Remove the following line if you want to block blank referrer too
|
||||
RewriteCond %{HTTP_REFERER} !^$
|
||||
|
||||
RewriteCond %{HTTP_REFERER} !^http(s)?://(.+\.)?example.com [NC]
|
||||
RewriteRule \.(jpg|jpeg|png|gif|bmp)$ - [NC,F,L]
|
||||
RewriteCond %{HTTP_REFERER} !^https?://(.+\.)?example.com [NC]
|
||||
RewriteRule \.(jpe?g|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://example.com/blocked.png [R,L]
|
||||
# RewriteRule \.(jpe?g|png|gif|bmp) http://example.com/blocked.png [R,L]
|
||||
```
|
||||
|
||||
### Disable Image Hotlinking for Specific Domains
|
||||
Sometimes you want to disable image hotlinking from some bad guys only.
|
||||
``` 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]
|
||||
RewriteCond %{HTTP_REFERER} ^https?://(.+\.)?badsite\.com [NC,OR]
|
||||
RewriteCond %{HTTP_REFERER} ^https?://(.+\.)?badsite2\.com [NC,OR]
|
||||
RewriteRule \.(jpe?g|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://example.com/blocked.png [R,L]
|
||||
# RewriteRule \.(jpe?g|png|gif|bmp) http://example.com/blocked.png [R,L]
|
||||
```
|
||||
|
||||
### Password Protect a Directory
|
||||
|
|
Loading…
Reference in New Issue