.htacess redirect from subdomain to full URL

Sometimes, Google or other search engines start to crawl your subdomains, indexing everything without your knowledge. And your search results start to appear something like this - http://subdomain.mainsite.com/page.html, instead of http://mainsite.com/page.html. All paths to pages are same except the subdomain added to the URL.To redirect all your subdomains to main site URL, add following line in your .htaccess file.[cc lang="htaccess"] RewriteEngine On RewriteCond %{HTTP_HOST} ^(www.)?[^.]+.mymainsitename.com.*$ RewriteRule (.*) http://mymainsitename.com/$1 [L] [/cc]
    New question is currently disabled!