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.