2010-04-07 63 views
0

我有三個文件夾中的「測試」的.htaccess用於顯示.html文件

one.php 
two.php 
print.html 

和我有相同的文件夾

RewriteEngine On 
RewriteBase /test/ 
RewriteRule ^(.+)\.html$ $1\.php [L] 

.htaccess文件,如果我們把打印.html在瀏覽器中,會出現錯誤,因爲.htaccess文件, 因爲沒有'print.php'頁面

我們應該如何通過修改.htaccess文件來解決它。所以,雖然採取print.html,它應該顯示在瀏覽器

回答

0

試試這個。

RewriteEngine On 
RewriteBase /test/ 
#If the request is for a file that exists already on the server, the "$1\.php" rule isn't served. 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteRule ^(.+)\.html$ $1\.php [L]