最近换到hawkhost,他们用的是LiteSpeed Webserver作为HTTP服务器软件,而不是Apache,以前使用的htaccess在这里不生效。在网上找了很久也没找到关于LiteSpeed服务器用htaccess的防盗链写法。咨询了他们一下,说是按Apache的写法可以使用,结果我是研究了很,终于写了个能用的,代码在下面:

引用

RewriteEngine on

RewriteCond %{HTTP_REFERER} !^http://planetidc.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://planetidc.com$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.planetidc.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.planetidc.com$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.xaoyo.net/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.xaoyo.net$ [NC]
RewriteCond %{HTTP_REFERER} !^http://xaoyo.net/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://xaoyo.net$ [NC]
RewriteRule .*\.(jpg|jpeg|gif|png|bmp|css)$ - [F,NC]


RewriteRule .*\.(jpg|jpeg|gif|png|bmp|css)$ - [F,NC]这句还可以改一下以显示自己想显示的错误信息

引用
RewriteRule .*\.(jpg|jpeg|gif|png|bmp|css)$ /404.shtml [R,NC,L]

相关日志
Hawkhost主机
『技术文摘』 | 评论(0) | 引用(0) | 阅读(169)
发表评论
拒绝任何人以任何形式在本博客发表不雅语言与中华人民共和国法律相抵触的言论!
表情
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
打开HTML
打开UBB
打开表情
隐藏
记住我
昵称   密码   游客无需密码
网址   电邮   [注册]