【问题标题】:disable https for single page with htaccess使用 htaccess 禁用单个页面的 https
【发布时间】:2015-12-05 09:41:14
【问题描述】:

我尝试了一些 htaccess 语句,但它对我不起作用。我需要将整个站点与 https 一起使用,除了一个页面需要来自另一个站点的 http 连接,因此我需要为此页面禁用 https。

Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R,L]

RewriteCond %{HTTPS} on
RewriteCond %{SCRIPT_FILENAME} \/exp\.php [NC]
RewriteRule ^(.*)$ http://%{HTTP_HOST}/$1 [L,NC]

浏览器说重定向似乎太多了。

【问题讨论】:

    标签: php apache .htaccess mod-rewrite url-rewriting


    【解决方案1】:

    您可以使用以下代码:

    Options +FollowSymLinks
    RewriteEngine On
    RewriteCond %{HTTPS} ^off$
    RewriteCond %{REQUEST_URI} !exp\.php$
    RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R,L]
    

    【讨论】:

      猜你喜欢
      • 2012-04-11
      • 1970-01-01
      • 1970-01-01
      • 2010-11-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-08-13
      • 1970-01-01
      相关资源
      最近更新 更多