0

プロジェクト URL から index.php を削除できません。以下は、私がそのために試したコードです。

同じサーバーでホストされている別のプロジェクトで正しく機能する同じコードと構成設定の下

.htaccess ファイル内

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php|imgs)
RewriteRule ^(.*)$ index.php/$1 [L]  
RewriteRule ^media/images/([0-9]+)/([A-Za-z0-9-]+).jpg?$ imgs/$1  [T=image/jpeg,L]
<Files "index.php">
AcceptPathInfo On
</Files>

.htaccess ファイルは、アプリケーション フォルダーと並行してルート フォルダーの下に配置されます。

config.php ファイル内

$config['uri_protocol'] = 'PATH_INFO';
(also tried same for all server global mentioned in config.php)

and

$config['index_page'] = '';

現在のプロジェクトのURLはhttp://Hostname/ODP/次のとおりです(これは上記のコードでは機能しません)

以前のプロジェクトの URL はhttp://Hostname/WCP/(上記のコードで機能するもの)

4

1 に答える 1

1
Use following htaccess code to remove index.php from your codeigniter url
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt|css)
RewriteRule ^(.*)$ ./index.php/$1 [L]
于 2013-08-05T10:24:31.667 に答える