3

What would the rewrite rule be to change subdomain.domain.tld to domain.tld/subdomain?

Or should I look at a VirtualServer directive to take subdomain.domain.tld and serve it from a DocRoot that happens to be also found at domain.tld/subdomain?

And where would the rewrite rule want to live, if using a rewrite is more appropriate?

update - found the link here: http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html

1 Answer 1

1

No you don't need to setup a virtual server, just use this rule :

RewriteEngine on
RewriteCond %{HTTP_HOST} ^([^.]+)\.domain\.tld$
RewriteRule ^/(.*)$ http://domain.tld/%1/$1 [L,R]
3

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .