【问题标题】:.htaccess http to https with files.htaccess http 到 https 与文件
【发布时间】:2014-10-22 17:20:41
【问题描述】:

我正在尝试编程从 http 到 https 的重定向,并删除 www。它已经可以了,我的问题是,如果你写:http://www.dominio.com/something/ 应该更改为https://dominio.com/something/ 并且不起作用,在 .com 之后没有检测到任何东西有人帮我吗?

RewriteEngine On 
RewriteCond% {HTTPS} off 
RewriteCond% {HTTP_HOST} ^ www.midominio.com 
RewriteRule ^ (. *) $ Https://midominio.com/$1 [R = 301, L] 

RewriteCond% {HTTPS}! = On 
RewriteRule ^ / (. *) Https:% {SERVER_NAME} // / $ 1 [R = 301, L]

【问题讨论】:

    标签: apache .htaccess mod-rewrite redirect https


    【解决方案1】:

    认为这个问题之前已经回答过:http to https through .htaccess 和这里 .htaccess redirect both http:// with and without www and https://www to https:// non-www

    RewriteEngine On
     RewriteCond %{HTTPS} !=on
     RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R,L]
    

    【讨论】:

    • 谢谢,但不起作用,在其他主题中不存在答案 RewriteEngine On RewriteCond% {HTTPS} off RewriteCond% {HTTP_HOST} ^ www.midominio.com RewriteRule ^ (. *) $ Https://midominio.com/$1 [R = 301, L] RewriteCond %{HTTPS} !=on RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R,L]
    猜你喜欢
    • 2016-04-23
    • 2015-02-20
    • 2010-12-21
    • 2019-06-25
    • 1970-01-01
    • 2017-09-08
    • 2012-05-16
    • 1970-01-01
    • 2016-03-10
    相关资源
    最近更新 更多