Hello,
I would like to ask if anyone has solved a similar problem. I have gone through the discussion forum but no advice has helped me.
I have the following problem. We have a website where the frontend is localized:
domain.com/en/contact
domain.com/de/kontakt
domain.com/it/contatto
This is fine, it works fine for me. I set it up this way:
PHP Code:
$routes->group('', ['namespace' => '\App\Controllers\Frontend'], static function ($routes) {
$routes->get('/{locale}/([a-zA-Z0-9_-]+)/', 'Router::show/$1');
});
We have the controllers divided like this:
/app/Controllers/Backend/
/app/Controllers/Frontend/
When I added {locale} to the URL, my backend stopped working. I can't figure it out, can someone help me?
PHP Code:
$routes->group('', ['namespace' => '\App\Controllers\Backend'], static function ($routes) {
$routes->add('backend/dashboard', 'Dashboard::index', [
'as' => 'dashboard.index'
]);
});
The application returns a 404 error because there is no language code in the given URL for the backend.
I would need to introduce some kind of exception so that the above rules don't apply to /backend. So that the URLs are localized only when I'm not in the backend.
Can someone help me?