【问题标题】:Redirect some url to https in .htaccess在 .htaccess 中将一些 url 重定向到 https
【发布时间】:2013-04-10 12:05:05
【问题描述】:

我希望这个 url 被重定向到 https:

www.example.com/iscrizioni
www.example.com/inscripciones
www.example.com/inscripcions

和所有其他人到 http

如何在 htaccess 中做到这一点?

问候

【问题讨论】:

  • 到目前为止你有没有尝试过?

标签: .htaccess redirect apache2


【解决方案1】:
RewriteEngine On

RewriteCond %{HTTP_HOST} ^(www\.)?example\.com$ [NC]
RewriteCond %{HTTPS} off
RewriteRule ^/?(iscrizioni|inscripciones|inscripcions) https://www.example.com%{REQUEST_URI} [L,R]

RewriteCond %{HTTP_HOST} ^(www\.)?example\.com$ [NC]
RewriteCond %{HTTPS} on
RewriteRule !^/?(iscrizioni|inscripciones|inscripcions) http://www.example.com%{REQUEST_URI} [L,R]

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-11-24
    • 1970-01-01
    • 1970-01-01
    • 2016-02-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多