3

CI のファイルパスから index.php ファイルを削除したい。ubuntu 12.04 を使用しています。私はほとんどすべてのフォーラムの結果を試しましたが、成功しませんでした。

CI フォルダーをこのパスに配置します。

http://localhost/xxx/CI/

私は apache rewrite mod enable を持っています。

sudo a2enmod rewrite
Module rewrite already enabled

conf.php ファイルにもこれがあります

$config['uri_protocol'] = 'AUTO';
$config['base_url'] = 'http://localhost/xxx/CI/'; 
$config['index_page'] = '';
$config['index_url'] = '';

これは .htaccess ファイルにあります

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L]

.htaccess ファイルはこのパスにあります

http://localhost/xxx/CI/.htaccess

そして、それもApacheを介して有効にされます

/etc/apache2/sites-available/default
AllowOverride All

このようなファイルにアクセスすると、このエラーが発生します

 http://localhost/xxx/CI/login/
 404 Error
 The requested URL /xxx/CI/login/ was not found on this server.

どんな助けでも大歓迎です。

ありがとう

4

3 に答える 3

1

以下を試してください:

RewriteEngine On
RewriteBase /xxx/CI/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /folder/index.php/$1 [L]

そしてApacheのrewrite_moduleを有効にする必要があることを確認します。

設定の index_page は空白にする必要があります $config['index_page'] = '';

于 2013-04-01T07:45:43.303 に答える
0

htaccessファイルにこのコードがありますか

RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
于 2013-04-01T07:43:20.387 に答える