Disable hot linking or direct download of my videos and only stream the video when it's displayed from a page in my website

為{幸葍}努か 提交于 2019-12-09 01:47:43

问题


I want to disbale hot linking of FLV and MP4 videos hosted on my server, except when the videos are displayed from a page which its URL starts with :
http://www.mywebsite.com/index.php?main_page=videos_page&

What are the apache configurations that I have to add to my .htaccess file?


回答1:


To disable hot-linking and replace the content with a generic site logo fo sorts to direct people back to your site rather then the image, add this to the .htaccess folde rin the root of your site:

Options +FollowSymlinks
RewriteEngine On
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?yoursite\.com/ [NC]
RewriteCond %{REQUEST_URI} !hotlink\.(gif|png\SOME FILETYPES NOT TO HOTLINK) [NC]
RewriteCond %{REQUEST_URI} !^/index.php?main_page=videos_page&
RewriteRule .*\.(gif|jpg|png)$ http://www.mywebsite.org/generic/imagetoreplace.png [NC] 

Remember, .htaccess is hidden, so make sure 'show hidden files' it turned on in yoru ftp client.



来源:https://stackoverflow.com/questions/6382021/disable-hot-linking-or-direct-download-of-my-videos-and-only-stream-the-video-wh

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!