I also rewrite subdomain to domain as a script parameter (PARAMETER.domain.com to domain.com/script.php?id=PARAMETER) for all domains I use. My mod_rewrite part of .htaccess looks like:
- Code: Select all
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{HTTP_HOST} !^www\.(domain\.com|domain\.eu|domain\.net)$ [NC]
RewriteCond %{HTTP_HOST} ^(www\.)?([^\.]+)\.(domain\.com|domain\.eu|domain\.net)$ [NC]
RewriteRule ^$ /script.php?id=%2 [QSA,L]
RewriteRule .* - [L]
The issue is with Google indexing service which doesn't index content if is the same on more than one domain. I can simply use one domain (eg. com) as main and redirect remaining ones (eu, net) to that one. Problem then is that I loose subdomain as a script parameter solution for remaining domains (eu, net).
So my question is - how to redirect:
- Code: Select all
domain.eu, domain.net to domain.com (with and without www.)
and
SUBDOMAIN.domain.com, SUBDOMAIN.domain.eu, SUBDOMAIN.domain.net to domain.com/script.php?id=SUBDOMAIN (with and without www.)
Thank you!