可以利用apache的虚拟主机的配置设置:
2个域名一个是xxxxx.com ,一个是aaaaa.com
xxxxx.com配置只访问jpg文件,aaaaa.com可以访问所有文件
<VirtualHost *:80>
DocumentRoot "/phpstudy/file/thinkphp"
ServerName xxxxx.com
<Directory "/phpstudy/file/thinkphp">
order allow,deny
<filesmatch "\.(jpg)$">
Order allow,deny
allow from all
</filesmatch>
</Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "/phpstudy/file/thinkphp"
ServerName aaaaa.com
</VirtualHost>
配置好后重启apache生效