Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6558761
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T13:14:22+00:00 2026-05-25T13:14:22+00:00

I have set up a folder with a controller in it: controllers/admin/home.php , but

  • 0

I have set up a folder with a controller in it: controllers/admin/home.php, but I get a 404 from the browser when I try to access it.

This is my routes file:

$route['employers'] = "employers/home";
//$route['employers/dash'] = "employers/dash";
$route['default_controller'] = "home";
$route['404_override'] = '';

This is the controller file:

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

class home extends CI_Controller {

    function __construct(){

        parent::__construct();

        /*
            enable profiler
        */
        //$this->output->enable_profiler(TRUE);     

        $this->load->helper('url');
        $this->load->library('ion_auth');
        $this->load->library('session');

        $this->load->library('form_validation');

        $this->load->helper('layout');
    }
}

.htaccess seems fine standard. Any ideas on what i’m doing wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T13:14:23+00:00Added an answer on May 25, 2026 at 1:14 pm

    Note some things:
    1) Routes are executed in the order they’re written, and your custom routes MUST follow the default ones. So, it should be:

    $route['default_controller'] = "home";
    $route['404_override'] = '';
    $route['employers'] = "employers/home";
    

    This if your controller “home” is inside the folder “employers”.

    2) Controllers don’t need all that stuff you wrote, indeed you don’t even need to call the parent constructor unless you’re planning to load libraries and resource for the whole controller’s methods (which can be achieve also by autoloading them in the autoload.php file), so it could simply be:

    file: application/controllers/employers/home.php
    
    class Home extends CI_Controller {
    
        function index()
        {
           // this is the method you're calling with your URL!
        }
    }
    

    3) As per above, and as already pointed out by @Wesley, with your url you’re trying to access the INDEX method of your controller HOME in your subfolder EMPLOYERS. But you didn’t defined an index() method (which is the one called by default if no other is supplied).
    It seems, instead, that CI is trying to look for an employers controller and a home method; if it doesnt find it, but you have a employers folder, it tries to access the index method in the home controller in the employers folder. And, since it didn’t find it either, you’re getting the 404 page.

    Hope I’m clear, otherwise just ask.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a admin folder set up in my controllers directory, under that i
I have a set of .php files in a folder, I want to add
I have a set of images in a folder call 'uploads/', all the files
Suppose I have a set of commits in a repository folder... 123 (250 new
I have multiple websites set up in the same folder, and I want to
If I have a folder structure set up like this: ~/Projects emacs package1 package1-helpers
I have a Visual Studio Setup project which has a Application Folder DefaultLocation set
I have some PDF files in a public rails folder. I want to set
I am trying to rewrite my urls to go from /controller/method to index.php?/controller/method, and
I have a set of folders that has a depth of at least 4

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.