0

私の.htaccessファイルは次のとおりです。

RewriteEngine on

RewriteCond $1 !^(index\.php|resources|robots\.txt|img/|css/|js)

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

URL から削除し、 からへindex.phpのリダイレクトを強制しますが、 を入力しても にリダイレクトしません。これをどのように解決できますか?example.netwww.example.nethttp://example.netwww.example.net

4

3 に答える 3

1

.htaccessファイルでこれを変更します

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

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

設定ファイルで2つの変更を加えました:

$config['base_url'] = 'http://'.$_SERVER['SERVER_NAME'].'/CiFolderName';
$config['index_page'] = '';
于 2013-03-01T11:16:07.600 に答える
0

htaccessを設定する

Options +FollowSymLinks +ExecCGI

<IfModule mod_rewrite.c>
  RewriteEngine On
  #RewriteBase /

  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule ^ index.php [QSA,L]
</IfModule>

設定でindex.phpを削除します

$config['index_page'] = '';

また、apacheでhtaccessをオーバーライドできるようにします

nano /etc/apache2/sites-available/default

と変更

        AllowOverride All

apacheを再起動します

于 2013-03-01T10:52:27.757 に答える
0

index.php ファイルと一緒に、.htaccess ファイルをアプリケーションのルート ディレクトリに配置します。(htaccess 拡張子が正しいかどうかを確認してください。Bz htaccess.txt は機能しませんでした。)

そして、次のルールを .htaccess ファイルに追加します。

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

次に、application/config/config.php ファイルで次の行を見つけます。

$config['index_page'] = 'index.php';

以下のように変数を空に設定します。

$config['index_page'] = '';

それだけです、それは私のために働きました。

さらにうまくいかない場合は、次の変数をこれらのパラメータ ('AUTO'、'PATH_INFO'、'QUERY_STRING'、'REQUEST_URI'、および 'ORIG_PATH_INFO') で 1 つずつ置き換えてみてください。

$config['uri_protocol'] = 'AUTO';
于 2013-03-01T12:07:52.813 に答える