No URI present. Default controller set - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: Installation & Setup (https://forum.codeigniter.com/forumdisplay.php?fid=9) +--- Thread: No URI present. Default controller set (/showthread.php?tid=71525) |
No URI present. Default controller set - isreehari - 08-24-2018 My routing is not working. I removed the index.php with - https://github.com/bcit-ci/CodeIgniter/wiki/Removing-index.php-from-a-URL-path-in-XAMPP-for-Windows I am using the following settings: Fresh copy of codeigniter 3.1.9 ```php config.php $config['base_url'] = 'http://localhost/CodeIgniter-3.1.9/'; $config['index_page'] = ''; .htaccess <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php/$1 [L] </IfModule> routes.php $route['hello/(:any)'] = 'hello/$1'; controller - Hello.php <?php defined('BASEPATH') OR exit('No direct script access allowed'); class Hello extends CI_Controller { public function __construct(){ parent::__construct(); } public function index() { echo("Hello - index"); $this->load->view('welcome_message'); } public function hello(){ echo("hello"); $this->load->view('welcome_message'); } } When I navigate to http://localhost/CodeIgniter-3.1.9/hello it's loading the Welcome controller. logs: DEBUG - 2018-08-24 18:56:47 --> UTF-8 Support Enabled DEBUG - 2018-08-24 18:56:47 --> No URI present. Default controller set. DEBUG - 2018-08-24 18:56:47 --> Global POST, GET and COOKIE data sanitized DEBUG - 2018-08-24 18:56:47 --> Total execution time: 0.0227 ``` RE: No URI present. Default controller set - isreehari - 08-25-2018 That's my bad, I turned on $config['enable_query_strings'] = TRUE; in config that's why it's causing the issue. When I was reading the core uri.php file then it has following comment. // If query strings are enabled, we don't need to parse any segments. // However, they don't make sense under CLI. if (is_cli() OR $this->config->item('enable_query_strings') !== TRUE) I set $config['enable_query_strings'] = FALSE; then everything working fine. |