重写规则以“找不到页面”结束在 https 页面上
我的网站上有多个重写规则,如下所示,
^product/([0-9a-zA-Z]+)/([0-9a-zA-Z]+)$ /index.php?action=product&category=$1&type=$2
我还安装了自签名 ssl 证书,并且 php 重定向到 https 的页面很少。当我在这样的 https 页面上并单击与上述重写规则匹配的链接时,我最终会出现“未找到”错误页面
如何告诉 apache 所有重写规则都应该相对于 http 而不是 https 进行读取?
编辑: 我通过在 :443 Virtual Host 下添加重写规则的副本来解决这个问题
I have multiple rewriting rules like the one below on my site
^product/([0-9a-zA-Z]+)/([0-9a-zA-Z]+)$ /index.php?action=product&category=$1&type=$2
I also have self-signed ssl certificate installed and few pages on which php redirects to https. When I'm on such https page and click a link that matches above rewriting rules, I end up on 'Not Found' error page
How to tell apache that all rewriting rules should be read relatively to http, not https?
EDIT:
I sorted it out by adding copy of rewriting rules under :443 Virtual Host
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
假设您的 Apache 在标准端口上提供 HTTPS,您可以在规则之前添加一个条件:
编辑: 还有另一个变量,您可以检查(它位于 文档,也是):
因此,无论在哪个端口上提供 SSL,这都应该更好:
Assuming your Apache serves HTTPS on the standard port, you could add a conditional before the rule:
EDIT: There's another variable, you could check (and it's in the documentation, too):
So this should be better, regardless on which port SSL is delivered:
您可以尝试:
查看 htaccess HTTPS / SSL 提示、技巧和黑客
You can try:
Have a look at htaccess HTTPS / SSL Tips, Tricks, and Hacks