【问题标题】:Redirecting https to http expect one url with htaccess将 https 重定向到 http 需要一个带有 htaccess 的 url
【发布时间】:2015-02-13 11:33:23
【问题描述】:

我试图将我的网页重定向到正常的 http,但一个特定的 url 应该重定向到 https。

我试过了:

RewriteCond %{HTTPS} off
RewriteRule ^site-name\.html$ https://domain.com/site-name.html [L,R=301]

但是这样一来,正常的网站就可以通过http和https访问了。

也许你们可以帮助我。

【问题讨论】:

  • 好的,什么不起作用?你在这个 .htaccess 中还有其他规则吗?
  • 它以这种方式工作。该站点被重定向到 https 但是,所有其他站点都可以通过 http 和 https 访问(当我输入 domain.com 时)我想要,所有其他站点只能通过普通 http 访问

标签: .htaccess http redirect ssl https


【解决方案1】:

您可以让另一个人为所有其他页面重定向https->http:

RewriteCond %{HTTPS} on
RewriteRule !^site-name\.html$ http://domain.com%{REQUEST_URI} [NE,L,R=301]

RewriteCond %{HTTPS} off
RewriteRule ^site-name\.html$ https://domain.com%{REQUEST_URI} [NE,L,R=301]

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-07-07
    • 2018-01-21
    • 1970-01-01
    • 2012-11-02
    相关资源
    最近更新 更多