2016-08-02 111 views
1

我试图将我的codeigniter应用程序从我的WAMP安装首次移动到共享主机(justhost)。共享主机上的Codeigniter路由

在我的public_html文件夹中,我包含了我的应用程序的所有文件夹和文件。因此,例如,当我在文件管理器中打开public_html时,我会看到我的“应用程序”文件夹。

我有一个控制器“着陆”,我已经设置为通过$route['default_controller'] = 'Lander'

默认当我去www.mywebsite.com我看到那个被从着陆器控制器加载视图。问题是,在该视图中,我有一个链接<a href="login">Log in</a>,当我在WAMP上运行时,打开登录控制器,它与Lander控制器位于同一文件夹中。当我从托管网站点击此链接时,网址将转至www.mywebsite.com/Login,但我找不到404。

回答

0

在config.php

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

.htaccess应该

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] 

,并链接应该

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

应该是控制器呼叫login路线应该定义

+0

什么是您的网站的网址? –

+0

添加我的htaccess –

+0

我已经添加了您的htaccess,但我仍然无法找到我的登录控制器 – David