Htaccess仅适用于http

时间:2015-01-31 19:33:16

标签: apache .htaccess mod-rewrite

RewriteCond %{HTTP_HOST} ^(www\.)?domain\.tdl$
RewriteRule !^MySubFolder /MySubFolder%{REQUEST_URI}  [L]

为什么这个reirte条件仅适用于http而不适用于https?

1 个答案:

答案 0 :(得分:0)

使用mod_rewrite至少需要" AllowOverride FileInfo"在文档根目录上设置,以便它采取行动。

检查您的配置是否为SSL(默认情况下为/etc/httpd/conf.d/ssl.conf),确保它看起来像:

DocumentRoot /var/www/html
<Directory /var/www/html>
  AllowOverride FileInfo
</Directory>

AllowOverride的默认设置为“无”,因此添加FileInfo功能的任何其他设置(例如“全部&#39;”)都可以。
http://httpd.apache.org/docs/2.4/mod/core.html#allowoverride

有关此答案的更多信息,请访问:Why do .htaccess redirects work in http but not with https?
从那里我可以回答你的问题。