Closed cod3rshotout closed 1 year ago
Hello,
To redirect any non-localized URL to its localized version, you can set the config option redirect_to_localized_urls
to true
, and register the following fallback route with the FallbackController
at the end of your routes/web.php
file.
Route::fallback(\CodeZero\LocalizedRoutes\Controller\FallbackController::class);
This route also allows you to localize your 404 page with a custom 404 view that you define in the config file.
FallbackController
Hi, thanks for the quick reply. I already did this, but for some reason the route isn't redirected
Does the fallback route have the middleware applied?
If not, it will use the app locale to generate a localized URL.
And is the hello-world
route registered with the locale slug?
Maybe it's a combination of settings... Can you compare with these tests?
Does the fallback route have the middleware applied? If not, it will use the app locale to generate a localized URL. And is the
hello-world
route registered with the locale slug?Maybe it's a combination of settings... Can you compare with these tests?
Yes, the middleware was applied. Actuallly the SetLocale
middleware is correctly invoked but if I print the $locale
variable from handle
method of the middleware I get null
.
Also for some reason no method of FallbackController are invoked.
Did you fix it?
Hi, this is just a question not an issue .. I'm not sure how to do this. Essentially I have this old url:
https://example.com/hello-world
, that now is in 404, is there a way that if the locale prefix is not specified then the url will go directly onhttps://example.com/en/hello-world
?Let me know, thanks in advance