2016-12-19 5 views
1

Codeigniter HMVCでindex.phpを削除しようとしています。しかし、私は次のコードを完了できませんでした。Codeigniter HMVCのindex.phpを削除する

<IfModule mod_rewrite.c> 
RewriteEngine On 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)$ index.php/$1 [L] 
</IfModule> 

私はルートディレクトリに.htaccessファイルを置き、index.phpをconfigファイルから削除しました。それでも私は同じ問題に直面しています。あなたのconfig.phpファイル内

答えて

1

は、.htaccessファイルに次に

$config['index_page'] = ""; 
$config['uri_protocol'] = "REQUEST_URI"; 

を置くのindex.phpを削除し、あなたのURLを確認し、今

<IfModule mod_rewrite.c> 
RewriteEngine On 
RewriteCond $1 !^(index\.php|resources|robots\.txt) 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)$ index.php/$1 [L,QSA] 
</IfModule> 

を置きます。それが動作します。

1

いくつかのステップに従ってください:

  1. 後藤アプリケーション/設定/ config.phpの: その後、
    sudo a2enmod rewrite によって書き換えモードを有効に$config['index_page'] = 'index.php';

  2. $config['uri_protocol'] = 'AUTO';から $config['index_page'] = '';にと を置き換えます service apache2 restart

  3. ご希望の場合、次の.htaccessファイルを使用できます。

<IfModule mod_rewrite.c> RewriteEngine On RewriteBase/ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule>

関連する問題