0

I'm having troubles with this structure only on server environment:

controllers    
    -> Controller_home.php    
    -> folder 1/
      -> Controller_1.php
      -> Controller_2.php
      -> folder 2/
        -> Controller_3.php

Controller.home.php works fine

Controller_1.php works fine

Controller_2.php works fine

Controller_3.php doesn't work - it appears my custom 404 page error

I'm using CodeIgniter 3.0 version, and previously I had trouble with the required first letter of each controllers to be uppercase. So I rename all my controllers and models files to use the first letter as uppercase.

I thought the problem I'm having now could be due to the folders inside controllers/ not be uppercase, but it ain't because of that.

I repeat that the structure works on local environment.

Edit: As requested, my .htaccess file:

Options -Indexes
Options +FollowSymLinks

# Set the default file for indexes
DirectoryIndex index.php

<IfModule mod_rewrite.c>

    # activate URL rewriting
    RewriteEngine on

    # do not rewrite links to the documentation, assets and public files
    RewriteCond $1 !^(index\.php|public|robots\.txt)

    # do not rewrite for php files in the document root, robots.txt or the maintenance page
    RewriteCond $1 !^([^\..]+\.php|robots\.txt)

    # but rewrite everything else
    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.

    ErrorDocument 404 index.php

</IfModule>

<IfModule mod_expires.c>

    ExpiresActive on

    ExpiresByType image/jpg "access plus 1 month"
    ExpiresByType image/jpeg "access plus 1 month"
    ExpiresByType image/gif "access plus 1 month"
    ExpiresByType image/png "access plus 1 month"
    ExpiresByType image/bmp "access plus 1 month"

</IfModule>

My Controller_3.php (it's actually a Customers controller) code:

<?php if (!defined('BASEPATH')) exit('No direct script access allowed');

class Customers extends CI_Controller
{
    public function __construct()
    {
        parent::__construct();


    }

    public function index()
    {   
        $this->load->view('backend/customers/index');
    }
}
?>

Edit 2: My complete (so far) route file:

$route['translate_uri_dashes']                  = TRUE;
$route['default_controller']                    = 'home/login';
$route['404_override']                          = 'home/error';

$route['app/entities/index']                    = 'backend/entities/index';
$route['app/suppliers/index']                   = 'backend/suppliers/index';
$route['app/administration/customers/index']    = 'backend/administration/customers/index';
16
  • does controller1, and 2 work on your production server? or none of them do? what is the error is showing? Commented Feb 5, 2016 at 14:48
  • @jpganz18 yes, they work without any problem. Commented Feb 5, 2016 at 14:48
  • can you show the code for Controller_3? Commented Feb 5, 2016 at 14:50
  • do you perhaps have a .htaccess on your server thats making changes to that path? Commented Feb 5, 2016 at 14:51
  • @CodeGodie see my updated topic Commented Feb 5, 2016 at 14:53

1 Answer 1

1

After a tremendous amount of debug and with the help of the fellow @CodeGodie by giving me tips, I end up realizing it was some problem while transfering the System/ folder to my FTP server.

I downloaded again the CodeIgniter 3.0 framework, and just copy paste the System/ folder and it started working instantly.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.