Reputation: 386
I'm gonna make a new server that will work as an CDN for one of my sites.
I'm afraid of leechers will take my content and embed on different sites, is there anyway i can do so i only allow pictures to be seen if they come from my main domain?
For example:
I have an website called example.com here i display images/videos. When a user try to direct access my videos or photos that are on my cdn host (that i own) can i block such traffic? And make it look that the user is viewing it on/from example.com website?
With PHP i think how to do it, but can i do it in Apache config somehow?
Upvotes: 0
Views: 178
Reputation: 26965
Some CDN's offer hotlinking protection, take a look at CloudFlare for example.
When enabled, the "Hotlink Protection" option ensures that other sites cannot suck up your bandwidth by building pages that use images hosted on your site.
Currently seems that they only support this file extensions are gif, ico, jpg, jpeg, and png.
Upvotes: 0
Reputation: 168
Yes, you can do this with with Apache config. In the configuration for your webroot, add the following:
order deny,allow
deny from all
allow from example.com
Upvotes: 1