[Solved] From subdomain to root: best approach? [closed]


I cannot fully answer the SEO parts of this question. But as far as I know, it is no good idea to list a page with different domains at Google. Beside this, subdomains are not made for this purpose. At least I like addresses like http://pastry.com/cake much more than your examples.

The technical answer:

  1. You need an wildcard DNS record to map all subdomains to pastry.com
  2. You can rewrite with mod_rewrite

I’ve not tested this, but this is more an example to show how this might work:

RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\.pastry\.com$
RewriteCond %{HTTP_HOST} !^pastry\.com$
RewriteCond %{HTTP_HOST} ([^\.]+)\.pastry\.com  [NC]
RewriteRule ^(.*)$ http://pastry.com/#%1 [NE,R=301,L]

2

solved From subdomain to root: best approach? [closed]