【发布时间】:2017-11-20 08:34:42
【问题描述】:
实际上,我关心的是将内部和外部 IP 地址重定向到域名和任何 http://domain 流量到 https://domain,我通过在 httpd.conf 文件中添加这些行来实现:
#Redirect IP to domain name
<IfModule rewrite_module>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^172\.1\.20\.4$ [NC,OR]
RewriteCond %{HTTP_HOST} ^83\.101\.140\.185$ [NC]
RewriteRule (.*) http://ict-helpdesk.madanonwovens.com/$1 [R=301,L]
</IfModule>
#Redirect all connections to HTTPS
<IfModule rewrite_module>
RewriteEngine On
#Force SSL on all connections
RewriteCond %{HTTPS} off
RewriteCond %{REMOTE_HOST} !^127\.0\.0\.1
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
</IfModule>
但现在我想将https://IP-address 重定向到https://domain 因为当我写https://IP-address 时,它要求我添加异常并重定向到没有加密的页面。
请帮忙!
【问题讨论】:
标签: apache ssl https spiceworks