【问题标题】:rewrite http to https for few pages将 http 重写为 https 几页
【发布时间】:2012-07-18 00:35:49
【问题描述】:

我看到这里有类似的东西
How to force rewrite to HTTPS except for a few pages in Apache?
因此,如果有人可以帮助我解决相反的问题,我将不胜感激。
我需要重写
http://www.default.com所有请求
所以我这样做了:

Options FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} ^default.com
RewriteRule (.*) http://www.default.com/ [R=301,L]

现在我需要对某些网址强制使用 https 协议,例如:
@987654323@
等等。
我真的不知道。我今天已经为此奋斗了好几个小时,而我得到的最接近的是一些无限循环的重定向:P

另一件事是,在 CMS(由其他人编写)所在的子文件夹中,还有另一个带有一些重写规则的 .htaccess 文件,我不知道这是否会以任何方式影响我正在尝试做的事情。

如果您有任何建议,我将不胜感激。

【问题讨论】:

  • Jon Lin,它对我不起作用 :(

标签: http .htaccess mod-rewrite https


【解决方案1】:

对于每个网址,您需要这样做:

RewriteCond %{HTTPS} off
RewriteRule ^user/loginUser(.*)$ https://www.default.com/user/LoginUser$1 [R=301,L]

RewriteCond %{HTTPS} off
RewriteRule ^another/url(.*)$ https://www.default.com/another/url$1 [R=301,L]

等等

【讨论】:

    猜你喜欢
    • 2011-06-30
    • 2012-02-28
    • 2014-03-04
    • 2014-09-20
    • 2011-06-02
    • 2011-09-15
    • 2014-12-09
    • 2014-03-11
    • 1970-01-01
    相关资源
    最近更新 更多