如何传输和自动将url重定向到子域

I have domain is domain.com And 2 link url:

domain.com?user=abc
domain.com?user=def

=> How to config and redirect new url (follow format above) for below result

abc.domain.com
def.domain.com

How to ideas?

Ideas:

In PHP you can use something like header('Location: ....'); See PHP Manual

In Apache config you would use RewriteRule from module mod_rewrite See Apache Manual

In Nginx config you would use rewrite from module ngx_http_rewrite_module See Nginx config