Apache uses .htaccess anti-hotlinking prevent users from downloading

Today met a client at the Video Station, using Html5 player, initially wanted to hide the real address, tried many ways no way to hide, and finally try to cut into sections CK treatment, but poor user experience, cut into sections more will appear Caton situation.

Finally, customers can not and decided to adopt anti-hotlinking, prohibit non-binding domain of access to download video, also read a lot of tutorials, completely ignorant forced to look after the operation do not know how to negotiate.

We can only keep trying, finally to solve, as follows

SetEnvIfNoCase Referer "^http://youer.com" local_ref=1
SetEnvIfNoCase Referer "^http://www.youer.com" local_ref=1
<FilesMatch "\.(gif|jpb|png|css|js|swf|mp4)">
Order Allow,Deny
Allow from env=local_ref
</FilesMatch>

.htaccess file Just paste the above code and you want to restart Apache;

Note that SetEnvIfNoCase Referer be to add unlimited, how many how many domain name domain name is added,

Red part is the need to prevent hotlinking file suffix, set up more recommended CSS and JS is not a good shield, the shield belongs to so many helpless, customer requirements.

Restart Apache access video path results came out; 403 security chain will burst error, not nervous is normal;

Able to make a beautiful 403 page, or find a large search download on the line.

Guess you like

Origin www.cnblogs.com/shenjingwa/p/11403020.html