-
Notifications
You must be signed in to change notification settings - Fork 112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Not found page has wrong urls #33
Comments
Sorry, I've read closed issues, and found the answer |
As I understood correctly, this issue was a bug in previous versions? I guess I am missing something, only 404 pages are having wrong language urls... |
Could you add some simple example code to reproduce? It should especially show how and where you create the links. |
I think, I see now. You've used the example language selection widget, right? The offending line is probably this:
When Yii encouters an error, it runs the configured errorAction internally. This seems to change the current controller's route. I'm not sure yet, how to fix this. |
It's not so easy to solve this in a solid way. When a visitor used an invalid URL that leads to a 404, it could be, that the URL could not be resolved to a valid route. But the current route is required by the language selector, to create a different language URL for the current page. I think, the only valid workaround is not to show the language dropdown on the error page. I know, that's not perfect, but I can't think of a better solution - at least not a simple one. |
@laziz-karimov I've added error handling to the example. Can you try, if this works for you? |
Thanks a lot for response. It is working now. Small mistypes in your edited example: |
Ok, thanks. Fixed the example. |
Small mistype in Yii::$app->errroHandler->errorAction |
Fixed, thanks. |
I have a page with url
something.com/en/controller/method?id=12
and this page does not exist.
Generated links are:
something.com/ru/site/error?id=12
something.com/de/site/error?id=12
something.com/fr/site/error?id=12
But I need
something.com/ru/controller/method?id=12
something.com/de/controller/method?id=12
something.com/fr/controller/method?id=12
Any ideas? Thanks a lot in advance
The text was updated successfully, but these errors were encountered: