I have some jquery plugins hosted on my server, but I'd like it to be available only to my visitors.. I'm paranoid other websites might just link to my js files and steal my bandwidth. How would you solve this problem?
You can use your .htaccess file to restrict the domain.
Selective hotlinking prevention through .htaccess
Prevent Hotlinking of Image, Script, CSS etc Using .htaccess
Cretae a .htaccess in the root of you site folder (for apache or IIS with ISAPI_Rewrite)
Replace mysite.com with your domain remebering that all . have to be backslashed in the RewriteCond and replace with a page you want to send them to when there trying to steal your bandwidth
RewriteEngine On
RewriteCond %{HTTP_REFERER} !^http://(.+\.)?mysite\.com/ [NC]
RewriteCond %{HTTP_REFERER} !^$
RewriteRule .*\. (js|json)$ http://mysite.com/theif.txt
and add theif.txt to your site with the code below (any site trying to steal your code will send all there users to http://www.yourhtmlsource.com/sitemanagement/bandwidththeft.html lol
top.location = "http://www.yourhtmlsource.com/sitemanagement/bandwidththeft.html";
They will soon unlink your script from there page
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With