Handling fake subdomains

Not sure if in wrong section, but couldn’t see where it might otherwise go!

I need to offer up my site in different languages and have all subdomains forwarding to my main www.

eg

fr.domain.co.uk -> displays www.domain.co.uk

So i need to add some code in the htaccess to take the ‘fr’ part of the domain and send it to eg

domain.co.uk/fr/

What’s the best way to do this?

but why?
Why don’t you want to stay at fr.domain.co.uk?

well really i havent decided exactly the best way to do this!

I just actually found this which works:

RewriteCond $1 !^forum/
RewriteCond %{HTTP_HOST} ^forum\.example\.com
RewriteRule (.*) /forum/$1 [L]

This will mean duplicating all files in the subfolder fr/
As most of my site is dynamically driven off several php files (+ mysql db), what is the best way to do multi language design?

What’s the technology do you use for subdomain forwarding?
Your web-server must be set up to handle subdomains without redirecting.
so, request fr.domain.co.uk -> displays the same fr.domain.co.uk
nothing else you need.

correct, but then i need to process which language was being called and apply that to the scripts.

But you already know which language was being called!
Why to use HTTP_HOST in mod rewrite if you can use it in your script?