简体   繁体   English

在Codeigniter中没有默认控制器的重定向

[英]no redirection of default controller in codeigniter

It works fine on the localhost. 它在本地主机上工作正常。 But when i upload my files on a webhost it doesn't redirect to a default controller. 但是,当我将文件上传到虚拟主机上时,它不会重定向到默认控制器。 However by entering the url manually it loads the pages. 但是,通过手动输入url会加载页面。 what must we consider for loading the default controller? 加载默认控制器必须考虑什么?

here's my .htaccess 这是我的.htaccess

<IfModule mod_rewrite.c>

RewriteEngine On

# Set the rewritebase to your CI installation folder
RewriteBase /


# Send everything to index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

</IfModule> 

I've set the baseurl in config.php 我已经在config.php中设置了baseurl

$config['base_url'] = 'http://'.$_SERVER['SERVER_NAME'];
$config['index_page'] = 'index';

here's my routes.php 这是我的routes.php

$route['default_controller'] = "Home"; // Home is my default controller
$route['404_override'] = '';

Replace your following code in config.php 将以下代码替换为config.php

From: 从:

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

To: 至:

$config['index_page'] = '';

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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