Forum Moderators: phranque

Message Too Old, No Replies

Subdomain Spam / Redirect / 404

redirect subdomains to 404 errorpage

         

jabz

1:59 pm on Jul 26, 2008 (gmt 0)

10+ Year Member



Hi guys,

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

jdMorgan

8:24 pm on Jul 26, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If the 404 ErrorDocument served for subdomain requests is not yours, then the problem is likely that your DNS zone file is not pointing those subdomains to your server. Make sure you have a DNS A record (or CNAME) for "*.example.com." (note the trailing period after "com" - it is required) and that it is pointed to the IP address of your host.

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]

All three pieces must be in place for this to work.

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

jabz

12:31 am on Jul 27, 2008 (gmt 0)

10+ Year Member



Hey Jim.
Thank you very much for your reply. I understand everything you say. Sending the subdomains to 404 pages really does not make as much sense as redirecting them to my homepage.

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.:)

jdMorgan

2:42 pm on Jul 27, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Just stick a "www." in both lines above -- "example.com" is an example only. Escape the periods in the RewriteCond pattern as shown above; Otherwise the domains in both lines must be identical.

Jim

jabz

9:19 pm on Jul 27, 2008 (gmt 0)

10+ Year Member



Yupp, I made it. As the redirecting still does not work, I contacted GoDaddy. Unfortunately I have not a server for the site. :( I`ll see what they reply. So far, thanks a billion for your help. Really.

Jab