【发布时间】:2014-05-30 06:12:29
【问题描述】:
我对激活 SSL 的 htacces 重写规则有疑问。
在 htacces 中,我将所有地址 .php 重定向到 .html:
RewriteBase /
RewriteCond %{THE_REQUEST} (.*)\.php
RewriteRule ^(.*)\.php $1.html [R=301,L]
RewriteCond %{THE_REQUEST} (.*)\.html
RewriteRule ^(.*)\.html $1.php [L]
如果我通过以下方式添加 ssl 重定向到 https:
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
将 php 重写为 html 不起作用。
例如:
http://domain.com/test.html --- 工作
http://domain.com/test.php --> 重定向到 HTML 和工作
https://domain.com/test.php --> 未重定向 -- 工作
https://domain.com/test.html --> 错误 404 - 页面未找到
已解决 https站点的apache2配置有问题:
将 AllowOverride None 更改为 AllowOverride All
【问题讨论】:
标签: php html .htaccess redirect ssl