Can someone tell me, where the issue is ??
This is my controller
class Support extends CI_Controller {
public function __construct()
{
parent::__construct();
$this->load->model('support_model');
$urlarray = array("index","delete");
if(!in_array($this->uri->segment(2),$urlarray)){
$this->viewticket($this->uri->segment(2));
}
}
public function viewticket($id){
if(!empty($id)){
$this->load->view('templates/logged_header');
$this->load->view('support/view');
$this->load->view('templates/footer');
}
}
}
Here is my routes.php
$route['default_controller'] = "welcome";
$route['benefits'] = 'welcome/benefits';
$route['faqs'] = 'welcome/faqs';
$route['distributors'] = 'welcome/distributors';
$route['contact'] = 'welcome/contact';
$route['purchase'] = 'welcome/purchase';
//login routes
$route['login'] = 'login/index';
$route['logout'] = 'login/logout';
$route['404_override'] = '';
localhost/ciproj/support/hello-world
gives me 404 Page Not Found
error
If I use exit;
after $this->load->view('templates/footer');
, the page is showing me blank page.
I don't have anything in routes related to support and every other method is working Is there anything that i'm missing in routes ??
Thanks for the help.
404 error messages may occur when internet users come from external links from other sites that redirect them to deleted web pages. To solve this issue, restore the site backup. Note that this method only works if certain website pages are broken or show a 404 error.
You may receive a 404 error because the page did not load properly. Refreshing or reloading the webpage may fix the issue. You may refresh the page by clicking the refresh button at the top of your web browser or pressing the F5 button on your keyboard.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With