Default routing setup - 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: Default routing setup (/showthread.php?tid=72566) Pages:
1
2
|
Default routing setup - Tiny - 01-06-2019 I installed Codeigniter for the first time, read documentation. According to docs, the URI consists of set of segments: PHP Code: http://example.com/index.php/[controller-class]/[controller-method]/[arguments] PHP Code: http://example.com/index.php/blog Here is the code of the controller: PHP Code: <?php So the problem is, that default controller at PHP Code: http://example.com/ works, but everything else doesn't respond. RE: Default routing setup - jaweb - 01-07-2019 Hi, does http://example.com/index.php/blog/index work? If that works you have to edit your routes.php (in map application/config) grtz Jaweb RE: Default routing setup - Tiny - 01-07-2019 (01-07-2019, 02:08 AM)jaweb Wrote: Hi, does http://example.com/index.php/blog/index work? Thank you for reply. Neither URL http://example.com/index.php/blog/index, nor http://example.com/index.php/welcome (default controller) work properly. Even http://example.com/index.php/ produces Error 404. But 'default_controller' option works well. It always call correct controller on http://example.com/index.php RE: Default routing setup - jaweb - 01-07-2019 Hi Tiny, Make sure your 'base_url' is set in the config/config.php. Then set a route in your routes.php like: $route['blog/index'] = 'blog/index'; put it above the other entries. When you enter the url leave 'index.php' out. So the link will be "....example.com/blog/index" Hope that wil work. Grtz Jaweb RE: Default routing setup - php_rocs - 01-07-2019 @Tiny, What web server are you using? If you are using Apache do you have the mod_rewrite plugin turned on and the .htaccess file in root CI directory? RE: Default routing setup - Les Kaye - 02-21-2019 I have been RTFM about removing index.php from the URL https://www.codeigniter.com/user_guide/general/urls.html The instructions include putting this line in .htaccess RewriteRule ^(.*)$ index.php/$1 [L] This did not work for me until I put a slash in front of index.php like this RewriteRule ^(.*)$ /index.php/$1 [L] Is the manual wrong or is this an alternate configuration? I am using a Linux server with index.php in public_html. I suggest the manual needs updating as people will waste time over this. RE: Default routing setup - InsiteFX - 02-22-2019 There should be a trailing slash / on the end of the base url in config.php Route: PHP Code: /** Something like. RE: Default routing setup - Soon - 04-13-2019 (02-21-2019, 12:55 AM)Les Kaye Wrote: I have been RTFM about removing index.php from the URL Thanks for the share RE: Default routing setup - MAILITY - 05-21-2019 (01-07-2019, 01:07 PM)jaweb Wrote: Hi Tiny,I installed Codeigniter for the first time, read documentation. RE: Default routing setup - MAILITY - 05-21-2019 (01-07-2019, 03:15 AM)Tiny Wrote:(01-07-2019, 02:08 AM)jaweb Wrote: Hi, |