John Smith
John Smith

Reputation: 149

Hotlinking my Cascading Style Sheets

Someone told me that another person was hotlinking my CSS file. I was able to find with them using my CSS file. I'm not fine with them hotlinking my CSS file.

Is there anyway to only allow one single URL to use my css file?

I asked the person to stop and told them "you can take it and host it elsewhere", but it seems that they won't listen. I decided to change their background to something borderline nsfw, but that still didn't stop them from doing it again. I could start putting goatse and such, but that is going to be wasting my time.

Upvotes: 6

Views: 1516

Answers (4)

Kevin Bowersox
Kevin Bowersox

Reputation: 94499

You can use your .htaccess file to restrict the domain.

Reference 1

Reference 2 http://www.globinch.com/2011/04/13/prevent-hotlinking-of-image-script-css-etc-using-htaccess/

Upvotes: 6

amelvin
amelvin

Reputation: 9061

You can block access folders or files using server settings - http://support.microsoft.com/kb/324066 - but if you are in a hosted environment you may not be able to change these settings - you may have to make a request to your host.

Upvotes: 0

John Smith
John Smith

Reputation: 394

You could wrap the css in php code and check the referrer.

Upvotes: 0

Scott C Wilson
Scott C Wilson

Reputation: 20026

If your site is (or supports) PHP, you could put your CSS into a PHP file and include that in the files that need it. Then it would be safe from hot inclusion.

Upvotes: -1

Related Questions