Welcome Guest, Not a member yet? Register   Sign In
Routes error
#1

(This post was last modified: 05-20-2021, 12:51 PM by Bart Goossens.)

Problems with $routes - any idea
When  i add
$routes->add('demo', 'Test');
$routes->add('demosub', 'Test::subtest');

the url https://bitest.ugent.be/demosub works
the url https://bitest.ugent.be/test/subtest does not work.

When I remove the routes https://bitest.ugent.be/test/subtest will work again.
I have made a copy without the routes https://bitest.ugent.be/testother/subtest

no htaccess in de root.
htaccess in public folder (WWW)  see https://codeshare.io/G743bj

Routes files : https://codeshare.io/ax0nEB
Test controller :  https://codeshare.io/aJLJnZ

CI4  V4.1.2 - fresh rollout via composer
Reply
#2

(This post was last modified: 05-20-2021, 02:48 PM by iRedds.)

I wanted to explain the reason, but it takes a long time.
Therefore I say shortly.
Don't use auto-detecting routes + wildcard route (add() method)

Replace the add() method with the appropriate HTTP method.


https://github.com/codeigniter4/CodeIgni...ssues/4711
Reply
#3
Thumbs Up 

problem solved.
Changed to
PHP Code:
$routes->match(['get''put'],'demo''Test');
$routes->match(['get''put'],'demosub''Test::subtest'); 

both urls are working now
the url https://bitest.ugent.be/demosub
the url https://bitest.ugent.be/test/subtest
Reply




Theme © iAndrew 2016 - Forum software by © MyBB