【问题标题】:CodeIgniter links not working in localserverCodeIgniter 链接在本地服务器中不起作用
【发布时间】:2012-12-12 15:27:33
【问题描述】:

我有一个使用 CodeIgniter 框架运行的 PHP 项目的副本。它托管在某个服务器中,当我尝试访问特定 URL 时

www.xxxdomain.com/member/member/index

上面的 URL 正在加载一个带有 CSS 的页面

我以下面的方式调用相同的链接,页面仍在加载,但无法加载 CSS

www.xxxdomain.com/member/index.php/member/index

现在,当我下载此代码并尝试在我自己的本地服务器中运行时,当我尝试以 http://localhost/project1/member/member/index 调用时,当我将其调用为 http://localhost/project1/member/index.php/member/index 时,我同时收到 404 错误,所需的页面是加载但没有 CSS 加载。

为什么页面在我的服务器中使用相同的 URL 加载,而不是在我的 localhost 中运行?我更改了 base_url 设置,我非常确定我用 localhost url 而不是服务器 url 替换了所有实例,但问题仍然存在。

知道如何解决这个问题吗?

【问题讨论】:

  • .htaccess 在这里扮演角色..:)

标签: codeigniter amember


【解决方案1】:

在本地服务器的根 CI 文件夹中创建一个文件 .htaccess...

并粘贴此重写代码..

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

如果你想了解更多关于htaccess..

确保您将配置 index_page 留空....$config['index_page'] = "";

【讨论】:

    猜你喜欢
    • 2011-09-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-02-17
    • 1970-01-01
    • 2013-09-01
    • 2012-11-15
    • 2015-11-01
    相关资源
    最近更新 更多