21490 Posts in 5783 Topics by 2622 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 805 Views |
-
Hotlink protection

5 May 2009 at 8:19pm
Where i must insert this 3 Lines in my htaccess....
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?somedomainname\.ch(/.*)?$ [NC]
RewriteRule \.(bin|rar|zip|exe|ipsw|gif|jpg|GIF|JPG|jpeg|JPEG)$ http://www.somedomainname.ch/assets/sorry.gif [R,L]At the moment they are at this position. But they do not work.
I would only protect all my Files from Hotlinking.### SILVERSTRIPE START ###
<Files *.ss>
Order deny,allow
Deny from all
Allow from 127.0.0.1
</Files><IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /# RewriteCond %{HTTP_HOST} ^somedomainname\.ch [nc]
# RewriteRule (.*) http://www.somedomainname.ch/$1 [R=301,L]RewriteCond %{REQUEST_URI} !(\.gif)|(\.jpg)|(\.png)|(\.css)|(\.js)|(\.php)$
RewriteCond %{REQUEST_URI} ^(.*)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* sapphire/main.php?url=%1&%{QUERY_STRING} [L]
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?somedomainname\.ch(/.*)?$ [NC]
RewriteRule \.(bin|rar|zip|exe|ipsw|gif|jpg|GIF|JPG|jpeg|JPEG)$ http://www.somedomainname.ch/assets/sorry.gif [R,L]
</IfModule>
### SILVERSTRIPE END ###I would be very happy if some one can help me... because my Servertraffic is about 10GB /day only trought Hotlinking. ;-(
-
Re: Hotlink protection

7 May 2009 at 6:04am
You should place your rewrite rule above the SilverStripe rules, since these will match first and then your rule won't be executed at all.
Your file should look like this:### SILVERSTRIPE START ###
<Files *.ss>
Order deny,allow
Deny from all
Allow from 127.0.0.1
</Files><IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?somedomainname\.ch(/.*)?$ [NC]
RewriteRule \.(bin|rar|zip|exe|ipsw|gif|jpg|jpeg)$ http://www.somedomainname.ch/assets/sorry.gif [NC,R,L]RewriteCond %{REQUEST_URI} !(\.gif)|(\.jpg)|(\.png)|(\.css)|(\.js)|(\.php)$
RewriteCond %{REQUEST_URI} ^(.*)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* sapphire/main.php?url=%1&%{QUERY_STRING} [L]
</IfModule>
### SILVERSTRIPE END ###You can also remove the uppercase file endings and add a NC (not-case-sensitive) to the rewrite-rule flags (as I did above).
Be sure to alter the domain-name to match your domain, but I guess you know that
-
Re: Hotlink protection

10 May 2009 at 10:00pm
Thanks alot for your Help.
Now it worksCheers and i wish you a very good Day
| 805 Views | ||
|
Page:
1
|
Go to Top |


