简体   繁体   中英

Codeigniter redirect without index.php

I am using codeigniter 2.4 with my WAMP. Everytime I set the $config['index_page'] = '' , codeigniter cannot find the controller method. When I set it back to $config['index_page'] = 'index.php' , it can find the method again. I want to get rid of the index.php so that my ajax call can work correctly.

Here are my configuration files:

**.htaccess:**

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

**config.php**

$config['index_page'] = '';

I have an class which redirect the request to another class method, and here is the code:

redirect('auth/login', 'refresh');

This happens when the redirection code gets called and I am pretty sure the rewrite_module on my WAMP apache is on.

Can anyone help me? Thank you very much.

您应该在routes.php中定义默认控制器。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM