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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T12:58:36+00:00 2026-06-10T12:58:36+00:00

the title seems stupid. but i met the problem, now i can just type

  • 0

the title seems stupid. but i met the problem,
now i can just type http://ci.tao2tw.com, then routes to my index.php/entry function
but when i type http://ci.tao2tw.com/order , i wanna routes to another controller
order.php , however it doesn’t work !
is anything wrong in my setting??

now , i can not run test function under order controller by http://ci.tao2tw.com/order/test . instead, i should type
htpp://ci.tao2tw.com/index.php/order/test
i can not figure out??

thank you all in advance~
enter image description here
enter image description here

in routes.php

$route['default_controller'] = "index/entry";
$route['order'] = "order"; 
$route['404_override'] = '';

in config.php

$config['base_url'] = 'http://ci.tao2tw.com/';
$config['index_page'] = '';

in controller/index.php (it works fine )

class Index extends CI_Controller {

    public function __construct() // to remember use public
    {
        parent::__construct(); 
        $this->load->helper('url');
        //anchor(); 
    }
    public function entry() //just show index
    {
        $this->load->view('index_view',$data);      

    }

}

in controller/order.php ( no work )

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

class Order extends CI_Controller {

    public function __construct() // to remember use public
    {
        parent::__construct(); 
        $this->load->helper('url');

    }
    public function fill($action) // 顯示填寫表單
    {
        echo "test";
    }
   //http://codeigniter.com/user_guide/libraries/uri.html
    public function order($action)
    {
        echo $action;
    }
}

?>

.htaccess file

RewriteEngine on
RewriteCond $1 !^(index\.php|css|flash|images|img|includes|js|language|robots\.txt)
RewriteRule ^(.*)$ index.php/$1 [L]
~
  • 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-10T12:58:37+00:00Added an answer on June 10, 2026 at 12:58 pm

    Every controller must be called in CI after your index.php file.

    So if you don’t use a .htaccess file, your link to the order controller is like :

    http://ci.tao2tw.com/index.php/order/
    

    The .htaccess allows to skip the index.php file

     RewriteRule ^(.*)$ index.php/$1 [L]
    

    You can so call your controller with :

    http://ci.tao2tw.com/order
    

    Then, if you want to call a method in your order controller your url is :

    • without the .htaccess

      http://ci.tao2tw.com/index.php/order/fill

    • with the .htaccess

      http://ci.tao2tw.com/order/fill

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

Sidebar

Related Questions

I see another question on stackoverflow.com whose title seems similar but that doesnot fulfil
I'm sorry if the question looks stupid,but It seems I can't use my head
Sorry for the long title, but it seems most descriptive for my question. Basically,
I have what seems to be a simple problem, as stated in the title.
I know that my title seems with others from StackOverflow but my intention is
I know the title of this question is stupid, but I couldn't come up
Really sorry for the extremely stupid title, but if I know what it is,
I'm stuck with this kinda stupid problem. I saw examples of my problem, but
the question title seems pretty confusing, but this is what i want to achieve.
The question's title may sound stupid, but I have beenw wondering about the following

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.