Default routing setup |
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.
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 (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
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
I have been RTFM about removing index.php from the URL https://www.codeigniter.com/user_guide/g.../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.
02-22-2019, 04:09 AM
(This post was last modified: 02-22-2019, 04:18 AM by InsiteFX. Edit Reason: added example )
There should be a trailing slash / on the end of the base url in config.php
Route: PHP Code: /** Something like. What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
(02-21-2019, 12:55 AM)Les Kaye Wrote: I have been RTFM about removing index.php from the URL Thanks for the share (01-07-2019, 01:07 PM)jaweb Wrote: Hi Tiny,I installed Codeigniter for the first time, read documentation. (01-07-2019, 03:15 AM)Tiny Wrote:(01-07-2019, 02:08 AM)jaweb Wrote: Hi, |
Welcome Guest, Not a member yet? Register Sign In |