根据 URL 有条件 https 重定向到 http?(阿帕奇)

Joe*_*cey 3 ssl https redirect apache-2.2

现在,如果有人这样做,我 100% 会重定向https://mysite.com

<VirtualHost *:443>
   ServerAdmin webmaster@mysite.com
   ServerName mysite.com
   ServerAlias www.mysite.com

   RewriteEngine on
   RewriteRule (.*) http://%{HTTP_HOST} [L,R=permanent]
<VirtualHost>
Run Code Online (Sandbox Code Playgroud)

但是,现在我想有条件地重定向。如果用户访问https://mysite.com/abc/,那么我想使用 https;否则重定向。

我该怎么做呢?我尝试阅读文档,但找不到我需要的内容。

我在 Ubuntu Linux 上使用 Apache。

Thu*_*hus 5

尝试在RewriteRule之前添加RewriteCond(重写条件)。我会尝试写这样的东西:

RewriteCond %{REQUEST_URI} !^.*(abc).*$ [NC]

如果这没有帮助,这里有一些额外的阅读:
- http://www.whoopis.com/howtos/apache-rewrite.html
- http://www.sitepoint.com/article/apache-mod_rewrite-examples/