將我們的Linux測試服務器從php 4升級到php 5後,服務器現在會提示用戶並嘗試在導航到test.domain時下載主頁-name.org。如果我專門指向索引文件,則沒有問題,頁面顯示正常。只有我們去test.domain-name.org纔會出現問題。這會生成一個下載提示。如果我導航到一個頁面特定的網址,如test.domain-name.org/index.html或test.domain-name.org/index.php,網頁加載正常。 Linux的人說他把服務器設置得和其他沒有問題的服務器一樣。作爲php的傢伙,我回復說我的代碼和mod_rewrite與我們其他沒有問題的網站完全相同。我能夠讀取phpinfo文件。 Apache版本是2.2.23。 PHP版本是5.3.21。我已閱讀其他帖子,但這個問題似乎是獨一無二的。這裏是我的主頁mod_rewrite的代碼在我的htaccess文件:服務器嘗試下載主頁 - 其他頁面/文件顯示正常
RewriteRule ^/?(index.html)?$ index.php [L]
嘗試'標題(「內容類型:text/html的; charset = YOUR-CHARSET')' – Peter 2013-02-21 17:21:49
在apache檢查:DirectoryIndex index.html index.cgi index.pl index.php index.xhtml – Satish 2013-02-21 17:32:06
@Peter,謝謝,但它仍然在提示下載。我將該代碼放在php文件的頂部,將charset定義爲utf-8。 – B6431 2013-02-21 17:39:51