I think this question is for serverfault.com. I will not dwell on this in detail, but you can set it using the RewriteCond, RewriteRule directives in the apache configuration.
I used both mod_proxy and mod_rewrite rules to achieve a similar effect. PS: check serverfault.com and ask sysadmin to try.
source share