Routes in Codeigniter - 404 Page Not Found

后端 未结 2 1863
故里飘歌
故里飘歌 2021-01-13 07:45

Can someone tell me, where the issue is ??

This is my controller

class Support extends CI_Controller {
    public function __construct()
    {
               


        
相关标签:
2条回答
  • 2021-01-13 08:22

    Judging the title, first of all check if your server is running PHP using CGI/FastCGI or not (you could simply check that by phpinfo()).

    If so, change the following in config.php:

    $config['uri_protocol'] = "REQUEST_URI";
    

    Back to the topic, you could achieve that by using the single-line route below within your routes.php file:

    $route['support/(?!index)(?!delete)(:any)'] = "support/viewticket/$1";
    

    And remove these lines from your __construct method:

    $urlarray = array("index","delete");
    if(!in_array($this->uri->segment(2),$urlarray)){
        $this->viewticket($this->uri->segment(2));
    }
    

    Let me know how it works.

    0 讨论(0)
  • 2021-01-13 08:24

    Since the above answer did not work for me, I just added this function in my default_controller, and it worked.

        public function __construct() {
        parent::__construct();
        $this->load->helper('url');
        }
    
    0 讨论(0)
提交回复
热议问题