Search code examples
phpapachewebservercdn

Making an CDN block leech traffic


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?


Solution

  • 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