We are moving our forum in GitHub Discussions. For questions about Phalcon v3/v4 you can visit here and for Phalcon v5 here.

Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Language slug URL redirects

Any ideas on how to redirect generic calls (that do not contain the language slug) such as http://site.tld/ or http://site.tld/controller/action to http://site.tld/LANG/ or http://site.tld/LANG/controller/action respectively?

I would prefer to do it from Phalcon, if it can be done, and not from .htaccess.



39.3k
Accepted
answer

Have a look at this topic:

http://forum.phalcon.io/discussion/1527/multilingual-routing

The routing works the same way you want it to.

Alternatively, have a look at the website repo https://github.com/phalcon/website/. We implement full language routing there, which is exactly what you need.