Welcome Guest, Not a member yet? Register   Sign In
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

(This post was last modified: 04-11-2020, 07:44 AM by stlake2011.)

(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
#4

(04-11-2020, 08:53 AM)haunui Wrote: my bad i just missconfigured my apache server

Hi, could you explain how you misconfigured the server, I'm having the same issue on an apache server
Reply




Theme © iAndrew 2016 - Forum software by © MyBB