2013-09-27 49 views

回答

0

嘗試:

RewriteEngine On 
RewriteCond %{THE_REQUEST} \ (.*)\.(php|html) 
RewriteRule^/%1 [L,R=301] 

RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME}.html -f 
RewriteRule ^(.*)$ /$1.html [L] 

RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME}.php -f 
RewriteRule ^(.*)$ /$1.php [L] 

或者。你可以使用多視圖,因爲這是什麼mod_negotiation是:

Options +Multiviews 
RewriteEngine On 
RewriteCond %{THE_REQUEST} \ (.*)\.(php|html) 
RewriteRule^/%1 [L,R=301] 
+0

我測試只有第一個和它的工作,Yaay!非常感謝 :) – user2823906