
1.在Apache配置中及域名底下加上彪红色的内容
[python]
<VirtualHost _default_:80>
DocumentRoot "F:phpstudyWWW"
<Directory "F:phpstudyWWW">
Options +Indexes +FollowSymLinks +ExecCGI
AllowOverride All
Order allow,deny
Allow from all
Require all granted
</Directory>
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://localhost/ [NC]
RewriteRule .(gif|jpg|png)$ https://www.baidu.com/img/bd_logo1.png [L]
</VirtualHost>
2.重启Apache
3.在localhost底下建立一个文件夹day1/
day1中包含uploads(包含图片) 和 test.html
test.html中的内容

用localhost访问照片
用127.0.0.1访问照片
4.完成配置
这样你就只有在你localhost底下才可以看到自己的图片,用别的域名或者127.0.0.1都不可以看到你所看到的图片




近期评论