Codeigniter-hide index.php with.htaccess
我的网站: 尝试通过以下方式访问我的网站中的活动时: 我得到一个未找到的错误: 在此服务器上找不到请求的URL/1 仅当我使用url中的index.php访问它时才有效,如: 我的控制器类似于:Codeigniter-hide index.php with.htaccess,.htaccess,codeigniter,.htaccess,Codeigniter,我的网站: 尝试通过以下方式访问我的网站中的活动时: 我得到一个未找到的错误: 在此服务器上找不到请求的URL/1 仅当我使用url中的index.php访问它时才有效,如: 我的控制器类似于: class Events extends CI_Controller { public function __construct() {} public function index() {} public function event() {
class Events extends CI_Controller {
public function __construct()
{}
public function index()
{}
public function event()
{}
}
我的路线:
$route['default_controller'] = 'events';
$route['(:num)'] = $route['default_controller'] . '/event/$1';
我的配置:
$config['index_page'] = '';
我的.htaccess:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
试试这个:
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
使用此链接谢谢,这解决了我的问题!
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]