如果需要 禁用IP 访问并且 需要 HTTP 跳转到 HTTPS
<VirtualHost *:80>
ServerName xxx.xxx.com
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(d{1,3}.){3}d{1,3}$
RewriteRule ^(.*)$ - [F,L]
RewriteRule ^(.*)$ https://%{HTTP_HOST}$1 [R=301,L]
</VirtualHost>
禁用IP 访问是
RewriteCond %{HTTP_HOST} ^(d{1,3}.){3}d{1,3}$
RewriteRule ^(.*)$ - [F,L]HTTP
跳转到 HTTPS是
RewriteRule ^(.*)$ https://%{HTTP_HOST}$1 [R=301,L]
凑合着用, 如果已经有内容把这些放在</Directory>后, 而不是里面, 网上竟然有人说里面 晕让大家折腾的浪费时间.