Rewrite url to subdomain format

Hi all,

Is there anyone who can help me the solution for rewrite URL to subdomain format?

Example: I have this link , and I really want to rewrite and display it in format like:

Thanks for your helps!

You may start with yii guide

Hi, Thanks yugene! I got it!

Hi leenhat

I also search the solution for it

But no luck yet.

Please help me to resolve the problem with step by step


Note: just i want to get the language from my url’s subdomain to any global variable or url parameter