重写规则HTTP和HTTPS工作 [英] Rewrite Rule to Work on HTTP and HTTPS
问题描述
我有这个简单的重写规则,它在正常工作的 HTTP 的:
I have this simple rewrite rule and it works properly under http:
RewriteCond %{HTTP_HOST} ^www\.siku-siku\.com$
RewriteRule ^/work/all.html /portfolio/ [L,R=301]
不过,该规则并没有考虑到效果时,我在的 HTTPS 的。我修改了规则设置为以下,但无济于事。
However, the rule doesn't take into effect when I was on https. I modified the rule set to the following but to no avail.
RewriteCond %{HTTPS} on
RewriteCond %{HTTP_HOST} ^www\.siku-siku\.com$
RewriteRule ^/work/all.html /portfolio/ [L,R=301]
我怎么能作出这样的规则在的 HTTP 的工作和双方的 HTTPS 的?请让我知道如果我需要提供更多的信息。
How can I make that rule to work both on http and https? Please let me know if I need to provide more information.
推荐答案
Apache使用了SSL配置不同的虚拟主机:
Apache uses a different vhost for ssl configuration:
<IfModule mod_ssl.c>
<VirtualHost _default_:443>
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.siku-siku\.com$
RewriteRule ^/work/all.html /portfolio/ [L,R=301]
...
</VirtualHost>
</IfModule>
该链接具有与Debian的SSL配置Apache的例子,但应该很容易推断你是对的 http://www.debian-administration.org/articles/349
This link has an example for configuring Apache with SSL on Debian, but should be easy to extrapolate to whichever platform you are on http://www.debian-administration.org/articles/349
这篇关于重写规则HTTP和HTTPS工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!