I have a multilingual website and I need change the URL based on a cookie value.
For example, I have $_COOKIE["lang"] = "en"
and I want to change the URL to either www.mydomain.com/en/rest/of/the/url
or en.mydomain.com/rest/of/the/url
.
How can I do this?