0

皆さんが mod_rewrite を codeigniter でどのように実装しているのかよくわかりませんし、今それを行う必要があるかどうかさえわかりません。私が望むのは、ルート ディレクトリを追跡する index.php を削除することです。そのため、www.mydomain.com/index.php/mycontroller から削除し、www.mydomain.com/mycontroller/ を作成します。

4

3 に答える 3

4

上記の誰もが.htaccessについて言ったことに加えて、設定する必要もあります

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

$config['index_page'] = '';

/application/config/config.php ファイルに

于 2012-06-27T21:50:48.077 に答える
2

.htaccess ファイルを変更することで、index.php を非表示にすることができます。例えば、

RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]

CodeIgniter の URL について詳しくは、http: //codeigniter.com/user_guide/general/urls.htmlをご覧ください。

于 2012-06-27T02:07:47.763 に答える
-1

これを.htaccessに配置して、URLからindex.phpを削除できます

    #### Remove index.php ###
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ /index.php?/$1 [L]
    #### index.php ###
于 2012-06-27T03:39:39.177 に答える