【问题标题】:How to redirect https://ip.address to https://domain如何将 https://ip.address 重定向到 https://domain
【发布时间】: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


    【解决方案1】:

    最后,我通过在应用程序根目录中生成 .htaccess 文件来实现这一点,并在文件中添加了相同的规则,但它仍然要求在浏览器中添加异常,之后重写条件通过 IP 地址重写域名.

    有没有办法在用户输入https://IP-address时自动重定向到域名而不在浏览器中添加异常。

    【讨论】:

    • 这不是答案。请通过提供真实答案而不是寻求其他帮助来回答您自己的问题。您可以编辑您的问题。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-06-11
    • 2023-03-28
    • 2011-07-06
    • 2011-08-12
    • 1970-01-01
    相关资源
    最近更新 更多