[英]htaccess will only redirect web pages i.e php and html
I am trying to use hotlink protection with my website and the code doesn't appear to work (I copied this off a site) 我正在尝试对我的网站使用热链接保护,但是代码似乎无法正常工作(我是从网站上复制此代码的)
So I tried redirecting everything with to an image what is hosted on a separate website to see if the rewrite was working and I found that the rewriterule would only redirect web pages such as a php file or html 因此,我尝试将所有内容都重定向到单独网站上托管的图片,以查看重写是否有效,并且我发现重写器只能重定向网页,例如php文件或html。
here is the code I used to redirect all files: 这是我用来重定向所有文件的代码:
RewriteRule ^.*$ http://www.filetransit.com/images/screen/8d3171cb63e905f67bb7685f4b033bfb_AQL_htpasswd_and_htaccess_Password_Manager.jpg [NC]
And i have turned the rewriteEngine on 我已经打开了rewriteEngine
If you want to do a hotlink protection to any url on your webpage you may use HTTP_REFERER
如果您想对网页上的任何网址进行热链接保护,则可以使用
HTTP_REFERER
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^http://([a-z0-9]+\.)?example\.com/.*$ [NC]
RewriteRule ^(.*)$ http://example.org/image.jpg [R,NC,L]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.