Redirect Wildcards
My company has set up, many years ago, a wildcard for our website, so that anything.domain.com always points back to our site. Unfortunately, this is causing some of those urls to show up in Google searches. We came across this article: SEO Friendly Wildcard DNS Set Up for Apache, IIS, Nginx - StepForth Web Marketing Inc.
After trying to set up the redirects that are mentioned there, we have yet to find a working solution. I've tried setting this up in a few different .htaccess files (at /home/user, /home/user/public_html and /home/user/public_html/domain), none of which seem to work. I do however have regular redirects set up for some specific pages at /home/user/public_html/domain which do work. I am at a loss.
Does anyone have any suggestions for this?
Thanks!
-
Can you please paste the rule here. 0 -
This is the rule that was tried from the article: RewriteEngine on RewriteBase / #for all requests on xyzname.com RewriteCond %{HTTP_HOST} xyzname\.com$ [NC] #if they are not for the www.xyzname.com RewriteCond %{HTTP_HOST} !^www\.xyzname\.com$ [NC] #301 redirect to www.xyzname.com RewriteRule (.*) http://www.xyzname.com/$1 [R=301,L]0 -
Hello @PluggedP93 There's a pretty good few discussions on this issue here: Subdomains that don't exist are indexed by Google - Zombie subdomain removal via .htaccess But the rule listed should work as well, potentially with some modification to https if you're using it (which most everyone at this point should be). The change via google won't happen overnight though. 0
Please sign in to leave a comment.
Comments
3 comments