Forum Moderators: phranque
I have a question which I was not able to answer myself browsing the net.
I have a domain for quite some time, which was parked with networksolutions. As you maybe remember, they generated subdomains for their clients domains and used it to spam search engines.
Two weeks ago I took the domain to start a website. I have lot`s of trouble getting into the serps again. :( So far so bad. Now I realized that google still lists some of the subdomains generated by networksolutions. When I click the I get an errorpage, but it is not my errorpage. Now my question is, how can I redirect the non-working subdomains to my custom errorpage? Because if I just redirect to the 404 error page I create a header status 200 (OK).
So far my htaccess only contains the following:
# alsways use the prefix www.
RewriteCond %{HTTP_HOST} ^domain\.com$ [NC]
RewriteRule .* [domain.com...] [L,R=301]
# Custom Errorpages
ErrorDocument 401 /401/
ErrorDocument 403 /403/
ErrorDocument 404 /404/
ErrorDocument 500 /500/
The errorpages for everything in the root of the domain work.
Any ideas? Links or resources?
Thank you very much in advance, Jab
Then your hosting account will need to be set up (if it isn't already) to point those subdomains to your 'account' on the server.
Finally, you can 301-redirect all non-canonical domains to your canonical domain by changing your RewriteRule to:
RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST} !^example\.com$
RewriteRule (.*) http://example.com/$1 [R=301,L]
Using a 301 tells the search engines to drop the old subdomains, and may confer some of their PageRank (if they have any) to your main domain. Using a 404 does nothing, because 404 means "Not Found for an unspecified reason -- This resource might return, or it might not." Therefore search engines will request 404 URLs for years and years if they keep finding links to them. Most search engines also treat 410-Gone --a much more specific response-- as a 404. This is really bad form, since you can't use it to say, "This resource is Gone and gone forever, so don't come back and ask for it again!" and it means that a 301 is really the only 'answer' for your problem.
Jim
The only problem is (I guess) that I use the www.-version of my domains. With your rewrite rule change, I also redirect the www.-version to the non-www-version.
Is there a way to keep only that subdomain (I understand www.domain.com is a subdomain)? If not, I can only redirect each and every subdomain manually, right?
I hope you ca help me. Even after you gave me several rewrite-documentation documents last year, I`m sill not able to solve this problem.:)