因为thinkphp的url不带.html后缀也能访问,因而经过apache rewrite规则重写了301重定向,php
相似于domain.com/news/3之类的url所有跳转到domain.com/news/3.htmlhtml
.htaccess文件以下thinkphp
<IfModule mod_rewrite.c> RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_URI} !(\.html)$ [NC] RewriteRule ^/?(.*)$ /$1.html [QSA,R=301,L] RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L] </IfModule>