正如我的標題所說,我從URL中成功刪除index.php
,但顯然當我輸入「index.php?
」時,它不起作用。我搜索了一切,但沒有發現這個問題。刪除index.php正在工作,但不是爲index.php?
下面是代碼在我.htaccess
(我用CI也):
RewriteEngine On
RewriteBase/
RewriteRule ^index.php/(.*)$ $1 [R=301,L]
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L,QSA]
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
預先感謝您!
我得到anubhava答案: 的RewriteCond%{THE_REQUEST} /指數\。 php [NC] RewriteRule ^(。*?)index \ .php $%{QUERY_STRING}? [L,R = 302,NC,NE] –