Routes in Codeigniter - 404 Page Not Found
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.
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'); }