2012-01-04 31 views
0

我使用的httpd.conf與mod_rewrite的除去從網頁文件擴展名....的httpd.conf命令爲.htaccess

我在httpd.conf使用的代碼是

<IfModule mod_rewrite.c> 
     Options +FollowSymLinks 
     Options +Indexes 
     RewriteEngine On 
     RewriteCond %{SCRIPT_FILENAME} !-d 
     RewriteRule ^([^\.]+)$ $1.html [NC,L] 
    </IfModule> 

這並不使用.htaccess文件在我的外部服務器上工作,並且我無法訪問httpd.conf文件....

任何想法如何更改命令,以便我可以刪除所有.html .htaccess改爲........

在此先感謝:d

+0

沒有你確定它不工作測試哪些網址,以及結果是什麼? – 2012-01-05 23:26:58

+0

如果該代碼是在.htaccess文件,它只是加載錯誤頁面,404 .... 我知道,htaccess和httpd.conf的代碼是不同的,並試圖逐行刪除,我認爲問題是RewriteRule ....線 – 2012-01-05 23:56:03

+0

和我測試了幾乎所有的網站,我的網站有和沒有頁面擴展名....沒有歡樂 – 2012-01-05 23:56:32

回答

0

請嘗試以下的.htaccess文件

Options +FollowSymLinks 
Options +Indexes 
RewriteEngine On 
RewriteBase/

#if an html version of this file exists 
RewriteCond %{REQUEST_FILENAME}\.html -f [NC] 
#then server it 
RewriteRule . %{REQUEST_FILENAME}.html [NC,L] 
+0

謝謝你現在試試看:D – 2012-01-06 00:31:36

+0

OMG非常感謝它的工作.....我可以擁抱你..... – 2012-01-06 00:33:46