routing - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: routing (/showthread.php?tid=64468) Pages:
1
2
|
routing - davy_yg - 02-22-2016 Hello, This is a simple CI3 code that I am still new to: Routing --> I already read the documentation and still having a little problem with it. Can anyone help me? routes.php PHP Code: $route['default_controller'] = 'welcome'; Welcome.php PHP Code: public function index() views/table.php PHP Code: <html> I am trying to test the codes by typing this url: http://localhost/ci3/add Code: Object not found! I wonder why? RE: routing - skunkbad - 02-22-2016 If you're not us get mod_rewrite to remove index.php from your URLs, then try /index.php/add. RE: routing - freddy - 02-22-2016 as like @skunkbad said you need to call it by href you cannot type in url, let me teach you ya here is router.php Code: $route['default_controller'] = 'welcome'; here is controller Code: <?php view calling from welcome Code: <h1> Here is view from welcome </h1> view calling by function table Code: <h1> Here is view from table function </h1> RE: routing - davy_yg - 02-23-2016 Hey, I wonder did I configure the router correctly? I wonder why I have type this to open the table: http://127.0.0.1/ci3/index.php/welcome/table ? I also try altering my .htaccess in order to remove index.php from the url and have not been successful yet. Can you help? .htaccess Code: <IfModule mod_rewrite.c> Can you help me figure why I cannot remove the index.php? Thanks in advance. RE: routing - freddy - 02-23-2016 (02-23-2016, 02:13 AM)davy_yg Wrote: Hey, I wonder did I configure the router correctly? well first issue already solved or not ? RE: routing - freddy - 02-23-2016 this is how to remove index.php ht acsess Code: RewriteEngine on then goes to config.php find Code: $config['index_page'] = 'index.php'; change become Code: $config['index_page'] = ''; then you success remove index.php this i give source code, just learn on it in here RE: routing - davy_yg - 02-23-2016 Hello, I have followed your last advice and still have not been successful removing the index.php I still have to type: http://127.0.0.1/ci3/index.php/welcome/table to show the table. I have alter .htaccess : RewriteEngine on RewriteCond $1 !^(index\.php|resources|robots\.txt) RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php?/$1 [L,QSA] config.php $config['index_page'] = ''; RE: routing - InsiteFX - 02-23-2016 (02-23-2016, 10:50 AM)davy_yg Wrote: Hello, Where is your RewriteBase / ? RE: routing - freddy - 02-23-2016 (02-23-2016, 10:50 AM)davy_yg Wrote: Hello, duh, good luck yah RE: routing - skunkbad - 02-23-2016 For what it's worth, my standard .htaccess: Code: RewriteEngine On |