2014-03-07 75 views
1

我对CodeIgniter非常陌生,所以很明显我遇到了最基本的问题。我最近试图实施一个关于当地环境的网站。我正在使用WAMP,并且网站位于www/public_html中。现在,该网站是工作在我的本地主机,但如果我尝试导航到默认值(default_controler)任何其他页面返回找不到像CodeIgniter无法找到除default_controller以外的其他任何东西

The requested URL /public_html/signin/login/ was not found on this server 

我认为,该网站的目的是通过解决其路径有关的问题本身。我显然错过了一些非常基本的东西。

我改变了config.php文件中的base_url的方式。

$config['base_url'] = 'http://localhost/public_html/'; 

我不知道base_url在哪里或在哪里改变它。任何帮助将不胜感激。

Zain

+0

你访问该网站由'http:// localhost /'或'http:// localhost/public_html'? – sunshinejr

+0

使用http:// localhost/public_html /。默认_controller工作。如果我将其从“欢迎”更改为“登录”控制器,它就可以工作。但不会从那里去任何地方。 – user3106759

回答

-3

ther是您的index.php的问题。检查此行

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

,如果它的工作原理u必须添加HT访问文件从乌尔删除URL的index.php

有很多关于网络的.htaccess文件代码尝试使用一个适合你

+0

谢谢,我会尝试。 – user3106759

+0

如果使用index.php,它会进入'$ config ['index_page']',而不是'$ config ['base_url']'。 – Samutz

+0

yaa它是一样的东西..它工作,即使你使用它在基地网址..只是为了检查 – Mohan

2

你得到这个问题,因为你没有正确配置你的.htaccess文件。在你.htaccess文件文档根目录必须满足下列条件

<IfModule mod_rewrite.c> 
    RewriteEngine On 

    RewriteBase/
    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteRule ^(.*)$ index.php?/$1 [L] 
</IfModule> 

在你config.php你需要做

$config['index_page'] = ''; 

你还需要确保你有启用了mod_rewrite

+0

这个。或者在config.php中设置'$ config ['index_page'] ='index.php';'在本地机器上进行测试,如果你不能启用mod_rewrite(发生)。 – sunshinejr

+0

谢谢。让我试试这个。 – user3106759

+0

我已经把这个在我的.htaccess文件中,并删除所有其他。仍然没有变化。 – user3106759

相关问题