diff --git a/README.md b/README.md index d11d6ba..882858e 100644 --- a/README.md +++ b/README.md @@ -34,10 +34,13 @@ What we are doing here is mostly collecting useful snippets from all over the in - [Disable Image Hotlinking for Specific Domains](#disable-image-hotlinking-for-specific-domains) - [Password Protect a Directory](#password-protect-a-directory) - [Password Protect a File or Several Files](#password-protect-a-file-or-several-files) + - [Block Visitors by Referrer](#block-visitors-by-referrer) + - [Prevent Framing the Site](#prevent-framing-the-site) - [Performance](#performance) - [Compress Text Files](#compress-text-files) - [Set Expires Headers](#set-expires-headers) - [Turn eTags Off](#turn-etags-off) + - [Disable gzip Compression](#disable-gzip-compression) - [Miscellaneous](#miscellaneous) - [Set PHP Variables](#set-php-variables) - [Custom Error Pages](#custom-error-pages) @@ -283,6 +286,24 @@ Require valid-user ``` +### Block Visitors by Referrer +This denies access for all users who are coming from (referred by) a specific domain. +[Source](http://www.htaccess-guide.com/deny-visitors-by-referrer/) +``` apacheconf +RewriteEngine on +# Options +FollowSymlinks +RewriteCond %{HTTP_REFERER} somedomain\.com [NC,OR] +RewriteCond %{HTTP_REFERER} anotherdomain\.com +RewriteRule .* - [F] +``` + +### Prevent Framing the Site +This prevents the website to be framed (i.e. put into an `iframe` tag), when still allows framing for a specific URI. +``` apacheconf +SetEnvIf Request_URI "/starry-night" allow_framing=true +Header set X-Frame-Options SAMEORIGIN env=!allow_framing +``` + ## Performance ### Compress Text Files ``` apacheconf @@ -390,7 +411,6 @@ By removing the ETag header, you disable caches and browsers from being able to FileETag None ``` - ## Miscellaneous ### Set PHP Variables @@ -478,4 +498,4 @@ RewriteCond %{HTTP_ACCEPT} image/webp RewriteCond %{DOCUMENT_ROOT}/$1.webp -f RewriteRule (.+)\.(jpe?g|png)$ $1.webp [T=image/webp,E=accept:1] ``` -[Source](https://github.com/vincentorback/WebP-images-with-htaccess) \ No newline at end of file +[Source](https://github.com/vincentorback/WebP-images-with-htaccess)