Apache - 如何将https添加到以下内容

时间:2013-04-09 18:15:50

标签: apache mod-rewrite

我想将https://添加到以下网址:http://www.createjobsforusa.org/donate

我怎样才能在Apache中执行此操作?

这是我到目前为止所做的,但不起作用:

  RewriteCond %{ENV:HTTPS} !on [NC]
  RewriteRule ^donate https://www.createjobsforusa.org/donate [R,L]

我需要改变什么?

2 个答案:

答案 0 :(得分:0)

您是否激活了重写引擎?

RewriteEngine On
RewriteCond %{HTTPS} !on [NC]
RewriteRule ^/?donate https://www.createjobsforusa.org/donate [R=301,L]

答案 1 :(得分:0)

请尝试使用此代码:

# once per htaccess file
RewriteEngine on

RewriteCond %{HTTPS} off
RewriteRule ^donate/?$ https://www.createjobsforusa.org/donate