CodeIgniter Forums
Routing - ignore first segment - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=31)
+--- Thread: Routing - ignore first segment (/showthread.php?tid=77045)

Pages: 1 2


RE: Routing - ignore first segment - jreklund - 07-17-2020

It's from our point of view nothing that's ment to work, but if it could work. It would be by any of those methods, but somewhere along in the code it appears to ignore variable replacements for controller, as it interprets them literally.

I looked over the code, and the reason for it not working are \$2, it thinks it's a literal string, and not a replaceable variable any more.
Code:
'\App\Controllers\$2::$3/$4'
'([^/]+)/([^/]+)/(.*)'
'\App\Controllers$2::haimethod/'
'ignore/haicontroller/haimethod'
'\App\Controllers$2::haimethod/'

The router needs to be re-written to this to work, as I can't find a hack to break free.