【问题标题】:Unable to access codeigniter controller in Live Server but accessible in localhost (xampp on windows)无法访问 Live Server 中的 codeigniter 控制器,但可以在 localhost 中访问(Windows 上的 xampp)
【发布时间】:2015-12-19 07:02:32
【问题描述】:

我的项目在本地系统 (XAMPP) 上运行良好,但是当上传到托管服务器时它无法运行。我正在使用 Codeigniter 框架。可通过 "localhost/myproject/controller" 在 localhost 中访问,但在主机服务器中无法通过 myproject.com/controller 甚至 myproject.com/index.php/controller 访问!!

在服务器上,主域是(假设 D.COM 和附加域是 AD.COM)。我的应用程序安装在插件域下。因此我的文件夹结构是

public html/
            AD.COM/
                  application/
                              Config
                              Controllers
                              Modules
                              Views
                  System/
                 User_guide/
                .htaccess

.htaccess 包含此代码

DirectoryIndex index.php
RewriteEngine on
RewriteCond $1 !^(index\.php|(.*)\.swf|forums|images|css|downloads|jquery|js|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php?$1 [L,QSA]

也维护了这些变量

$config['base_url'] = '';
$config['index_page'] = '';
$config['uri_protocol'] = 'REQUEST_URI';

如何解决这个问题。我尝试谷歌搜索,但没有得到任何帮助。提前致谢。

【问题讨论】:

  • 您的实时站点 URL 是什么??
  • 如果您访问索引页面,例如 myproject.com(无控制器),它会显示任何内容吗?
  • 现在我很难说,我的主机服务器操作系统是 LINUX。
  • 是的,它显示了实时服务器上的默认欢迎控制器。即当打开 myproject.com @webcrazymaniac
  • 您的实时网站 URL 是什么??

标签: php apache .htaccess codeigniter


【解决方案1】:

请注意Codeigniter 命名转换并注意Linux 主机区分大小写

您没有提供与您的问题相关的任何资源。因此,必须说明的是检查您的 url控制器名称拼写 以及您将进一步调用的 方法

【讨论】:

  • 我怎么错过了这件事。我用小写调用控制器,而它被定义为 Camel Cased。感谢您的及时回复。
猜你喜欢
  • 2018-06-02
  • 2016-06-12
  • 2015-11-10
  • 2015-11-03
  • 1970-01-01
  • 2016-01-22
  • 2018-01-17
  • 2019-07-18
  • 1970-01-01
相关资源
最近更新 更多