【问题标题】:Codeigniter Application showing 404 not foundCodeigniter 应用程序显示 404 未找到
【发布时间】:2014-10-31 04:54:01
【问题描述】:

我已将我的 codeigniter 应用程序部署到 ssl 服务器。此应用程序在我的电脑上运行,但在客户端服务器中产生问题。主页加载正常,但是当尝试浏览其他链接时,显示在此服务器上找不到请求的 URL /index.php/register。 Apache/2.2.22 服务器在 mydomain.com 端口 443

寻求专家的帮助。我检查了所有的链接和网址都没有问题。

<IfModule mod_rewrite.c>
RewriteEngine On
    RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php|images|robots\.txt)    
RewriteRule ^(.*)$ /index.php/$1 [L]

# Without mod_rewrite, route 404's to the front controller
ErrorDocument 404 /index.php

实际上是在我将 / 放在 index.php 之后发生了问题

【问题讨论】:

  • 您的 .htaccess 文件是什么?上传到服务器后更新了吗?
  • 您的站点未正确配置为在服务器上运行。检查您的 .htaccess 是否根据您的域进行了更新,同时检查您的 base_url 是什么?
  • 我尝试使用空的 base_url 并设置 mydomain.com 但没有运气。还有一件事默认控制器加载器没有任何问题,但是当我浏览其他控制器功能时会导致问题。
  • mydomain.com/index.php 此链接有效,但 mydomain.com/index.php 无法正常工作,显示 404 not found 当我要在 index.php 之后使用 / 时出现此问题

标签: php apache codeigniter


【解决方案1】:

好的,我终于找到了解决方案

htaccess 文件:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [PT,L]
RewriteRule !^[A-Za-z0-9_/\-\.]*$ - [L,R=404]

并设置 $config['base_url']='yoursitename.com' 并设置 $config['index_page]=''

【讨论】:

    猜你喜欢
    • 2017-11-03
    • 2021-10-24
    • 2012-05-18
    • 2011-04-26
    • 1970-01-01
    • 2020-12-07
    • 2016-06-23
    • 1970-01-01
    • 2015-08-14
    相关资源
    最近更新 更多