【问题标题】:.htaccess force https but only one page with http or https.htaccess 强制 https 但只有一页带有 http 或 https
【发布时间】:2017-01-09 09:02:07
【问题描述】:

我想将所有页面重定向到 https,不包括一页!

此页面 www.domain.com/data/push-send 应该可以通过 http:// 或 https://

访问

这是我当前的代码:

RewriteEngine On

# Redirect external .php requests to extensionless url
RewriteCond %{THE_REQUEST} ^(.+)\.php([#?][^\ ]*)?\ HTTP/
RewriteRule ^(.+)\.php$ /$1 [R=301,L]

# enforce a no-trailing-slash policy
RewriteRule ^(.*)/$ /$1 [L,R=301]

# Redirect api to data/push-send
RewriteRule ^api$ data/push-send [qsappend,L]

# no index in URL
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/
RewriteRule ^(.*)$ http://www.domain.com [L,R=301]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\ HTTP/
RewriteRule ^(.*)$ http://www.domain.com [L,R=301]

# force https
RewriteCond %{SERVER_PORT}   !^443$
RewriteRule  (.*)  https://%{HTTP_HOST}/$1   [R=301,qsappend,L]

我该怎么做

谢谢凯文

【问题讨论】:

    标签: http redirect ssl https


    【解决方案1】:

    我自己弄的

    # force https
    RewriteCond %{SERVER_PORT}   !^443$
    RewriteCond %{REQUEST_URI} !data/push-send [NC]
    RewriteRule  (.*)  https://%{HTTP_HOST}/$1   [R=301,qsappend,L]
    

    凯文

    【讨论】:

      猜你喜欢
      • 2011-03-02
      • 2018-11-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-01-22
      • 2012-06-17
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多