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 7809093
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T03:19:12+00:00 2026-06-02T03:19:12+00:00

I am customizing my routes in codeigniter, here is a sample of my routes.php:

  • 0

I am customizing my routes in codeigniter, here is a sample of my routes.php:

$route['default_controller'] = 'maincontroller/main';                                                                                                                                                                                    
$route['404_override'] = '';     

$route['test'] = 'maincontroller/test';

here is the maincontroller class:

class Maincontroller extends CI_Controller  
{                 
    public function __construct( )
    {
        parent::__construct( ); 
        $this->load->library('session');  
        $this->init( ); 
    }


    public function main( )         
    {       
        echo "in main";
    } 

    public function test( )
    {
        echo "test";
    }
}

but when i access this url in my browser: /test, i get the server’s 404 page not found error.

I have no idea what im doing wrong, i followed the routes guide in codeigniter user guide.

  • 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-06-02T03:19:14+00:00Added an answer on June 2, 2026 at 3:19 am

    Instead of going to /test , try going to /index.php/test

    By default CodeIgniter runs everything through index.php.

    You can change this behaviour by adding a .htaccess file to the site root folder.

    This is taken straight from the CodeIgniter user guide.

    https://ellislab.com/codeigniter/user-guide/general/urls.html

    The htaccess file

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

    If you do this you also need to change your config/config.php file

    find

    $config['index_page'] = 'index.php';
    

    change it to

    $config['index_page'] = '';
    

    When you want to create links in a page (view) you can use the built in site_url() function, you may need to load the url helper for this.

    for example

    <?php echo site_url('test'); ?>
    

    This will take into account the $config[‘index_page’] setting and create the right url for your link.

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

Sidebar

Related Questions

I'm customizing my WordPress login page. Here's what I want to achieve: /wp-login.php →
I'm customizing Wordpress's Twenty Eleven 'SearchForm' / 'searchform.php' -- I want to keep the
I'm customizing the UIButton programmatically here: button = [UIButton buttonWithType:UIButtonTypeCustom]; [button setSelected:YES]; button.frame =
I am customizing part of a PHP script that outputs HTML based on a
I'm customizing a color picker's default showing colors which will be used as background
We are customizing workflow approval form to display the associated list item fields. This
I'm working on customizing a couple of open source projects in ways that are
I am interested in customizing the authentication method for a Joomla website. There is
I am working on customizing a closed source client application. It has a tree
I am customizing N2CMS's database structure, and met with an issue. The two classes

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.