【问题标题】:Handling codeigniter application on server在服务器上处理 codeigniter 应用程序
【发布时间】:2017-08-16 05:46:55
【问题描述】:

我的 CODEIGNITER 站点在服务器上成功运行并成功运行,但是当我在同一服务器上的另一个文件夹中移动(复制和粘贴)内容时,出现 404 page not found 错误。

任何想法为什么?

【问题讨论】:

  • 请显示您在做什么以及返回的任何响应,这个问题需要扩展。
  • 查看application/logs下的日志文件。如果没有最近的条目,您甚至无法进入该框架。如果是这种情况,请直接检查网络服务器日志。 (例如 Apache:/var/log/apache2/error.log)
  • 我将 A(live) 文件夹的内容复制并粘贴到 B(new) 文件夹以进行更改,但似乎每当我尝试使用用户名和密码登录时,我都会收到此错误 -Object未找到!在此服务器上找不到请求的 URL。引用页面上的链接似乎是错误的或过时的。请将该错误通知该页面的作者。如果您认为这是服务器错误,请联系网站管理员。错误 404 localhost Apache/2.4.25 (Win32) OpenSSL/1.0.2j PHP/7.1.6
  • 确保你已经遵循这里解释的codeigniter文件和类命名方法codeigniter.com/user_guide/general/styleguide.html#file-naming它也可能你可能需要在主目录中的htaccess
  • 我做了检查,似乎所有的约定都符合用户指南。你能详细说明htaccess,要求吗? @wolfgang1983

标签: codeigniter server


【解决方案1】:

在项目文件夹中使用此htaccess,而不是在应用程序文件夹中

<IfModule mod_rewrite.c>
  RewriteEngine On
  # !IMPORTANT! Set your RewriteBase here and don't forget trailing and leading
  #  slashes.
  # If your page resides at
  #  http://www.example.com/mypage/test1
  # then use
  # RewriteBase /mypage/test1/
  RewriteBase /
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>

<IfModule !mod_rewrite.c>
  # If we don't have mod_rewrite installed, all 404's
  # can be sent to index.php, and everything works as normal.
  # Submitted by: ElliotHaughin

  ErrorDocument 404 /index.php
</IfModule>

如果您的文件夹不像 public_html/project_folder
而不是在这里改变

RewriteBase project_folder/

【讨论】:

  • 我做了,但没用。仍然收到 404 消息。
  • 确保这个 htaccess 的应用程序文件夹和默认 htaccess 驻留在应用程序文件夹中
猜你喜欢
  • 2020-02-28
  • 1970-01-01
  • 1970-01-01
  • 2011-11-04
  • 2022-01-17
  • 1970-01-01
  • 2011-06-23
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多