因爲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>