重写规则在http上工作,但在https上中断


RewriteRule working on http but breaks on https

我在htaccess中有一些RewriteRule,为我的登录页提供了一些漂亮的URL。url看起来像www.site.com/new-document,我的RewriteRule会使其成为www.site.com/index.php?page=新文档

通过这种方式,我可以保留漂亮的url,并使用index.php根据页面变量更改文本。

在http上一切都很好,但一旦我将https添加到url,我就会收到一个"未找到"错误,因为在RewriteRule中不会触发。

这是我的htaccess代码的副本

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule    ^new-document$            index.php?page=new-document
RewriteRule    ^old-document$            index.php?page=old-document
</IfModule>

Grasshopper和anubhava为我指明了正确的方向!

我的问题是https虚拟主机没有AllowOverride All指令。

<Directory /var/www/>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Order allow,deny
    allow from all
</Directory>

您可以在没有RewriteRule的情况下访问HTTPS URL吗?听起来Apache可能在使用不同的虚拟主机,或者根本不接受HTTPS。

相关文章: