2016-10-04 11 views
1
私は、次の.htaccessを使用

:CodeIgniterの中CodeigniterはGetリクエストでindex.phpなしで動作しませんか?

AddDefaultCharset utf-8 
RewriteEngine On 

RewriteBase/
DirectoryIndex index.php 
Options All -Indexes 

RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)$ /index.php?/$1 [L] 

また設定:だから

$config['index_page'] = ''; 
$config['uri_protocol'] = 'AUTO'; 

を、すべてのページは、URLパスdomain/index.php/page

で開かれている。しかし、それはdomain/pageのために動作しません。

+0

、私はこれをどのようにhtaccessファイルを動作しないようです確認できますか? mod_rewriteがオンになっているので – Babaev

+0

あなたはどのバージョンのcodeigniterを使用していますか? – user4419336

答えて

0
RewriteRule ^(.*)$ /index.php?/$1 [L] 

は、以下に、上記の行を変更してみてください:

RewriteRule (.*) index.php/$1 [L] 

具体的に、置換で?が除去されます。したがって、要求されたURLをクエリ文字列の一部として渡すのではなく(追加のクエリ文字列が使用されないようにする)、代わりに追加のPATH INFOとして渡されます。

RewriteRuleパターンのアンカーも必要ありません。置換のスラッシュ接頭辞も削除することができます。これがRewriteBaseディレクティブの目的です。

Options All -Indexes 

また、これは厳密には有効ではありません。あなたは+/- paramsとそれ以外のものを混ぜてはいけません。これは、おそらく次のようになります。

Options -Indexes 
0

が、これは設定ファイルに

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

を.htaccessファイル試し

$config['index_page'] = ''; 
$config['uri_protocol'] = 'REQUEST_URI'; 
+0

質問があれば教えてください! –

関連する問題