我有一些問題。在開發中,我使用的是PHP 7,而且我的網站運行良好。但在生產中它使用PHP 5.4和我在刪除index.php時遇到問題。我的網站託管在子文件夾中,就像myhost/mywebsitefolder
。刪除子文件夾代碼點火器中的index.php
問題是使用url函數時。例如,當我訪問「儀表板」頁面時,它將重定向到「登錄」頁面,並且該URL類似於myhost/mywebsitefolder/login
,並且它返回404頁面未找到。當我登錄之前添加index.php(myhost/mywebsitefolder/index.php/login
)它工作正常,但我必須通過添加index.php來替換我的所有網址。有沒有解決辦法。我的.htaccess就是這樣。
RewriteEngine on
RewriteBase /mywebsitefolder/
RewriteCond $1 !^(index.php|resources|gallery|json|slider|robots.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
用線'重寫規則^加問號嘗試$指數.php?/ $ 1 [L,QSA]'。 – Tpojka