• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
CI4 - Routing problem

#1
Hi,
When i load the URL that supposed to show my page, the server give me a 404 not found error. I added my routes on the app/Config/Routes.php file. I tried to add my routes before the default route ($routes->get("/")Wink, that doesn't help.

My routes :
Code:
$routes->get('/', 'Home::index');
$routes->add('hebergement', 'Home::hebergement');
$routes->add('prestations', 'Home::prestations');
$routes->add('activites', 'Home::activites');
$routes->add('contact', 'Home::contact');

How can i solved that ?
Reply

#2
(04-11-2020, 06:36 AM)haunui Wrote: Hi,
When i load the URL that supposed to show my page, the server give me a 404 not found error. I added my routes on the app/Config/Routes.php file. I tried to add my routes before the default route ($routes->get("/")Wink, that doesn't help.

My routes :
Code:
$routes->get('/', 'Home::index');
$routes->add('hebergement', 'Home::hebergement');
$routes->add('prestations', 'Home::prestations');
$routes->add('activites', 'Home::activites');
$routes->add('contact', 'Home::contact');

How can i solved that ?

https://codeigniter.com/user_guide/incom...-in-routes

Try changing this: 
PHP Code:
$routes->add('hebergement''Home::hebergement'); 
to this:
PHP Code:
$routes->get('hebergement''Home::hebergement'); 
 
and maybe add a / as well here:

PHP Code:
$routes->get('/hebergement''Home::hebergement'); 
Reply

#3
my bad i just missconfigured my apache server
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.