【发布时间】:2023-03-03 14:40:01
【问题描述】:
我目前已将 SSL 证书应用于我的网站,并且所有 URL 都正确重定向到 https。我需要其中一个 URL 为 HTTP。我的 .htaccess 中有以下代码,可将所有页面重定向到 HTTPS。
我希望下面的 URL 是 HTTP 而不是 HTTPS。
http://www.example.com/blog_rss.php
RewriteEngine on
RewriteBase /
RewriteCond %{ENV:HTTPS} !on [NC]
RewriteRule ^(.*)$ https://www.example.com/$1 [R,L]
提前感谢您的帮助!
【问题讨论】:
-
RewriteRule ^blog_rss.php etc...? -
你能澄清一下吗?
-
您的规则匹配所有内容。我的只有在请求的 url 是 blog_rss.php 时才匹配。而对于这样一个简单的重定向,您不需要使用 mod_rewrite。一个简单的
Redirect Permanent /blog_rss.php http://etc...也可以。 -
如果我只对特定页面使用简单的重定向。示例:重定向 301 /blog_rss.php http://www.example.com/blog_rss.php 它会导致重定向循环,因为我有一个全局重定向到 https。
标签: apache .htaccess redirect ssl https