【问题标题】:Making a directory ssl and all other pages/dirs not ssl使目录 ssl 和所有其他页面/目录不是 ssl
【发布时间】:2011-05-30 09:40:34
【问题描述】:

相当简单的请求.. 我想在 apache 上使用 mod_rewrite 将目录重定向到我网站上的 ssl,并使其在您导航到该目录之外时“脱离”ssl。使用以下方法很容易进入 https:

# Make gift-cards https
RewriteCond %{SERVER_PORT} 80 
RewriteCond %{REQUEST_URI} gift-cards 
RewriteRule ^(.*)$ https://%{SERVER_NAME}/staging/$1 [R,L,C]

# Make all other pages normal
RewriteCond %{SERVER_PORT} 443
RewriteCond %{REQUEST_URI} !gift-cards 
RewriteRule ^(.*)$ http://%{SERVER_NAME}/staging/$1 [R,L]

但是爆发证明是一个问题,我不太确定发生了什么..我的使所有其他页面正常规则似乎由于某种原因不起作用(并且我得到一个有趣的 'Found ' 消息,如果我不使用 C 将两者链接在一起)。

谢谢!

【问题讨论】:

  • 请注意,gift-cards 不是文件系统上的真实目录,稍后它会被重新写入 index.php 等。因为我在 wordpress 中使用它。 wordpress 规则在这些规则之下,这些是第一个。由于这些规则使用 L 修饰符,因此如果匹配,它们将是最后一次运行。

标签: mod-rewrite apache2


【解决方案1】:

我实际上是通过找到问题的根源并使用 wordpress SSL 插件解决了这个问题。

我想我可能会用这种方法叫错树,因为我不得不担心所有资源都通过 http 等加载。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-08-27
    • 1970-01-01
    • 2017-06-25
    • 1970-01-01
    相关资源
    最近更新 更多