<Directory /data/wwwroot/xwl.com>
SetEnvIfNoCase Referer "^$" local_ref
SetEnvIfNoCase Referer "www.xwl.com" local_ref
SetEnvIfNoCase Referer "xwl.com" local_ref
<filesmatch ".(|txt|doc|mp3|mp4|zip|rar|jpg|gif)">
//网上说是apache2.4以下,用这个
Order Allow,Deny
Allow from env=local_ref
//apache2.4以上用这个
Require all denied
Require env local_ref
</filesmatch>
在apache2.4.29经测试两种方式都可以。
</Directory>