刚才配置了SSL的301重定向,修改了.htaccess文件,然后发现除了主页可以正常打开,跳转也正常之外,其余页面,包括文章页,打开都只显示“The requested URL was not found on this server”。
于是查找问题,才知道我配置时删除了以前的PHP跳转规则,本站的.htaccess文件全文如下,供有类似问题的网站主参考。
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
RewriteCond %{HTTP:From-Https} !^on$ [NC]
RewriteCond %{HTTP_HOST} ^(www.)?taholab.com$ [NC] # 将taholab.com和www.taholab.com跳转到https://www.taholab.com,防止apache子站继承上级目录.htaccess受影响
RewriteCond %{HTTP_HOST} ^(www.)?taholab.com/$ [NC]
RewriteRule ^(.*)$ https://www.taholab.com/$1 [R=301,L]
</IfModule>
