David David - 6 months ago 65
PHP Question

Codeigniter routing on shared host

I am trying to move my codeigniter application from my WAMP installation to a shared host (justhost) for the first time.

In my public_html folder I have included all of the folders and files for my application. So for example I see my "application" folder when I open public_html in my file manager.

I have a controller "Lander" which I have set to be the default via

$route['default_controller'] = 'Lander'

When I go to www.mywebsite.com I do see the view that gets loaded from the Lander controller. The problem is that within that view I have a link
<a href="login">Log in</a>
that, when I'm running on WAMP, opens the login controller, which is in the same folder as the Lander controller. When I click this link from the hosted site the URL goes to www.mywebsite.com/Login, but I get 404 not found.


In Config.php

$config['base_url'] = 'http://stackoverflow.com/';
$config['index_page'] = ''; # remove index.php

.htaccess should be

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

and Links should be

<a href="<?php echo base_url() ?>login">Log in</a>

There should be a controller call login or in routes you should define