2011-09-23 88 views
1

我想用.htaccessmod_rewrite從我的所有文件中刪除.php並強制結尾斜槓/。但是,這隻會導致我得到服務器錯誤。從URL中刪除.php並強制結尾斜槓/

+0

可能的重複http://stackoverflow.com/questions/4026021/remove-php-extension-with-htaccess – nmc

回答

2

要映射:

http://sampledomain.ext/index/ -> http://sampledomain.ext/index.html 

使用下面的.htaccess

RewriteEngine On 
RewriteCond %{REQUEST_URI} ! \.php$ #Avoid real php page, do what you want with them 
RewriteCond %{REQUEST_URI} /$  #Ensure a final slash 
RewriteRule ^(.*)$ $1.php   #Add your extension 

的Tx大衛Wolever誰寫靜靜同樣的東西1

如果我可以給我的意見,強迫/最後爲文件不是有點奇怪?

相關問題