apache urlrewrite防盗链功能配置
程序员文章站
2022-06-19 10:29:09
documentroot /home/img servername img.host.com errordocument 404 / rewriteengine on re...
documentroot /home/img
servername img.host.com
errordocument 404 /
rewriteengine on
rewritecond %{http_referer} !^$
rewritecond %{http_referer} !^http://img.host.com/.*$ [nc]
rewritecond %{http_referer} !^http://www.host.com/.*$ [nc]
rewriterule \.(gif|jpg|jpeg)$ http://img.host.com/forbidden.png [r,l]
servername img.host.com
errordocument 404 /
rewriteengine on
rewritecond %{http_referer} !^$
rewritecond %{http_referer} !^http://img.host.com/.*$ [nc]
rewritecond %{http_referer} !^http://www.host.com/.*$ [nc]
rewriterule \.(gif|jpg|jpeg)$ http://img.host.com/forbidden.png [r,l]