Php CodeIgniter:推送服务器后找不到404页

Php CodeIgniter:推送服务器后找不到404页,php,codeigniter,Php,Codeigniter,我在我的本地机器上做了一些应用程序,运行正常,但在将其发送到服务器后,我收到了404错误页面,我尝试了所有方法,但都无效,你能帮我吗 a2enmod重写已启用 我在google中发现我需要在服务器上使用与本地机器上相同版本的php,否则我的应用程序将无法运行,这是真的吗 我的本地人: application/config/config.php $config['base_url'] = 'http://localhost:8888/app/'; $config['index_page'] = '

我在我的本地机器上做了一些应用程序,运行正常,但在将其发送到服务器后,我收到了404错误页面,我尝试了所有方法,但都无效,你能帮我吗

a2enmod重写已启用

我在google中发现我需要在服务器上使用与本地机器上相同版本的php,否则我的应用程序将无法运行,这是真的吗

我的本地人: application/config/config.php

$config['base_url'] = 'http://localhost:8888/app/';
$config['index_page'] = 'index.php';
$config['base_url'] = 'http://example.com/app';
$config['index_page'] = 'index.php';
$config['base_url'] = '';
$config['index_page'] = '';
我的服务器: application/config/config.php

$config['base_url'] = 'http://localhost:8888/app/';
$config['index_page'] = 'index.php';
$config['base_url'] = 'http://example.com/app';
$config['index_page'] = 'index.php';
$config['base_url'] = '';
$config['index_page'] = '';
我也试过: application/config/config.php

$config['base_url'] = 'http://localhost:8888/app/';
$config['index_page'] = 'index.php';
$config['base_url'] = 'http://example.com/app';
$config['index_page'] = 'index.php';
$config['base_url'] = '';
$config['index_page'] = '';

我被卡住了,你能帮我吗?

做这个

config.php中

  • $config['base\u url']=''
  • $config['index_page']=''
  • $config['uri_protocol']='AUTO'
  • config/routes.php
    文件中

    $route['default_controller'] = '';//default controller name
    $route['404_override'] = '';
    
    然后在
    .htaccess
    这应该放在应用程序文件夹的外侧

    
    重新启动发动机
    重写cond%{REQUEST_FILENAME}-F
    重写cond%{REQUEST_FILENAME}-D
    重写规则^(.*)$index.php/$1[L]
    
    .htaccess
    文件中尝试此代码,您没有提供对CodeIgniter目录的访问权限

    RewriteEngine on
    RewriteCond $1 !^(index\.php|assets|robots\.txt)
    RewriteRule ^(.*)$ /app/index.php/$1 [L]
    

    错误是:在控制器中是这样的:user.php,所以我重命名为user.php,我不太理解,但在线修复了我的代码

    使用user.php运行在我的本地,但不是在现场,如果有人知道为什么,请留下评论也

    谢谢大家的帮助


    干杯。

    你到底在做什么?如果你使用codeigniter 3.0,请确保你所有的控制器和模型都以大写字母Welcome.php more htaccess OMG:)开头,你的真命天子,我刚刚将我的控制器=从user.php重命名为user.php,并在网站上完美运行,upvoted:)谢谢,只是个问题你知道为什么会这样吗?我现在只是好奇。你可以留下一个答案,我会投票给你的,干杯。你好,阿卜杜拉,我做了,但我仍然得到错误:(你的网站URL是什么?
    holiday helper
    中没有控制器呼叫。你能给我看一下你的控制器代码吗?修改你的答案,然后把它贴在那里只要加载模型
    $this->load->model('User_model');
    我现在很困惑,我现在有2.htaccess,1个内部应用程序和另一个外部应用程序,可以吗?我也尝试了你的代码,但仍然无法工作:(只保留1个,那是在你的项目中。然后尝试我的代码。在第三行中,写下你实际的项目目录名,代替“app”.对不起,只保留里面的1.这是控制器的CodeIgniter 3约定。