I am really frustrated. Everything was working fine on a windows 7 localhost before but after I moved the codeigniter project to a ubuntu server running on a virtual box, everything becomes so frustrating.
The ubuntu server running on a virtual box has an ip address let's say 127.0.0.1 and the host ip address is 127.0.0.2. In the virtual box, I mapped the host ip and guest ip using the NAT adapter. So I can access the guest ip from host browser.
In the config.php, the base_url
is like this $config['base_url'] = 'http://'.$_SERVER['HTTP_HOST'];
so the base_url
is http://127.0.0.1
and the default controller is $route['default_controller'] = 'login';
On the host browser, the default page from the default controller can be loaded perfectly, but it does not apply the rest of the pages accessed using base_url, the pages cannot be found on the server when they are actually there.
<form name="frmLogin" id="frmLogin" method="POST" action="<?php echo base_url('login/login'); ?>">
<input type="text" placeholder="Email" id="txtEmail" value="<?php set_value('txtEmail') ?>" name="txtEmail">
<input type="password" placeholder="Password" id="txtPassword" value="<?php set_value('txtPassword') ?>" name="txtPassword">
<a href="#" class="forgot">forgot password?</a>
<input type="submit" value="Sign In" name="btnLogin" id="btnLogin">
</form>
In the form above, the controller login/login
cannot be found.
How can I set the routes.php in order for all the pages can be accessed using the base_url ?
在config.php
$config['base_url'] = '';
Managed to solve my problem, this issue occurred because in unix the file name is case sensitive and in windows it's not. I had to rename the controllerss and models' name starting with an uppercase letter in unix system
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.