1

codeigniter 1.7 に大きなアプリケーションがあり、それを 2.1 に更新しましたが、問題があります (404 ページが見つかりません)。現在の htaccess は次のとおりです。

rewriteEngine on
Options +FollowSymLinks

rewriteRule ^admin(.*) index.php/admin$1
rewriteRule ^supervisor/([0-9]+)(.*) index.php/supervisor_$1/$2
rewriteRule ^(login|logoff)(.*) index.php/base/$1$2
rewriteRule ^(files|attachment|meeting|thread|attachments|profile|search|roles|cat)(.*) index.php/moder/$1$2
rewriteRule ^(about|contact|new_majlis|stats)(.*) index.php/page/$1$2
rewriteRule ^(2.2-release-notes)(.*) index.php/page/release_notes

手伝ってくれませんか ?

4

1 に答える 1

0

まず、このようなルーティングはapplication/config/routes.phpファイルで行う必要があります。次のようなエントリを追加することをお勧めします。

$route['supervisor/(:num)/(:any)'] = 'supervisor/$1/$2'; // This also looks hackish
$route['login/(:any)'] = 'base/$1';
$route['logoff/(:any)'] = 'base/$1';


$route['about/(:any)'] = 'page/about/$1';
$route['contact/(:any)'] = 'page/contact/$1';
$route['new_majlis/(:any)'] = 'page/new_majlis/$1';
$route['stats/(:any)'] = 'page/stats/$1';
$route['2.2-release-notes/(:any)'] = 'page/stats/$1';

また、「きれいな」ページが必要だと仮定しています。/index.php/adminの代わりに/admin

.htaccessファイルの場合、上記のすべてを次のものに置き換えることができます。

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

これにより、CodeIgniter がすべてのリクエストを確実に処理できるようになります。


404 エラーの場合:

チェリーはあなたをバラバラにしますconfig.php。かなりの数の変更があったため、vanilla 2.1 バージョンを使用して、1.7 バージョンから以前に構成した変数を入力することをお勧めします。同じことが、フォルダー内の他のいくつかのファイルにも当てはまりますapplication/config

変更ログは、詳細について無限に役立ちます: http://codeigniter.com/user_guide/changelog.html

于 2012-04-18T17:21:29.573 に答える