Search code examples
apache.htaccesswildcard-subdomain

Sub domains on the fly or Wild Card subdomains


Is it possible to redirect everything in a subdomain to the main domain.

Eg

anything.example.com

something.anything.example.com

must all go to example.com

and

anything.example.com/page.php

something.anything.example.com/page.php

must all go to example.com/page.php

is this possible ? on a shared host ?


Solution

  • yah, sure that's possible. just set up a subdomain that's a wildcard (* on most apaches) and set the VH to be the site root.