1
這裏我想從我的codeigniter應用程序中的URL中刪除index.php。htaccess rewriterule在codeigniter中不工作
對於這一點,我寫.htaccess文件是這樣的:
# Turn on URL rewriting
RewriteEngine On
# Installation directory
# RewriteBase /projectname/
# Protect hidden files from being viewed
<Files .*>
Order Deny,Allow
Deny From All
</Files>
# Protect application and system files from being viewed
RewriteRule ^(?:application|modules|system)\b.* index.php/$0 [L]
# Allow any files or directories that exist to be displayed directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Rewrite all other URLs to index.php/URL
RewriteRule .* index.php [PT]
它在xx.xx.xx.xxx服務器和mydomain.com工作。在這裏,我試圖製作一個相同的副本到另一臺服務器yy.yy.yy.yyy。在此,重寫URL不起作用。如果我使用'yy.yy.yy.yyy/index.php/login',它的工作正常。但是'yy.yy.yy.yyy/login',它會拋出'在此服務器上找不到請求的URL /項目名稱/登錄名'。錯誤。