Apache configuration hotlink protection
How to set hotlink protection to prevent others from stealing pictures and videos, and what should be done?
1. Open the virtual host configuration file
Vi / usr/local/apache2/conf/extra/httpd-vhosts.conf
Add content
SetEnvIfNoCase Referer "^ http://.*\.test\.com" local_ref
SetEnvIfNoCase Referer ". *\ .lizheng\ .com" local_ref
Order Allow,Deny
Allow from env=local_ref
Deny from all
two。 Restart and load
Apachectl-t
Apachectl graceful
3. Refresh the page
4. To enable yourself to view pictures, put your domain name on the whitelist
Refresh the web page to display normally