Forum Moderators: phranque
We dropped from the rankings for no reason, but I did notice that when you do a:
site:example.com -asdfasdfsdf
That google had picked up several pages twice, all with the %20www.domain.com prefix...
I messed with mod_rewrite, now using
RewriteEngine On
RewriteCond %{HTTP_HOST} ^example.com
RewriteRule (.*) http://www.example.com [R=301,L]
(I've also tried all of the combinations listed here:
[webmasterworld.com...]
With no success...
However, when I started, if you typed in
"space"www.example.com, IE would take you to:
%20www.example.com
Now, if you type in "space"www.example.com it takes you to the proper domain, so I was hoping it's fixed!
However, if you type in %20www.example.com, it still brings up the homepage, and the %20 is still visible in the address bar! ARGH!
My host seems to be baffled (or less concerned by this than I am).
Is my problem fixed? What could be the problem?
Tempted to cloak all "www" requests from googlebot from
%20www.domain.com directly to
domain.com with a 301...
--Mark
[edited by: jdMorgan at 10:34 pm (utc) on Oct. 14, 2005]
[edit reason] example.com [/edit]
This indicates that you have "wild-card" DNS set up for the domain, so that all subdomains resolve to your host, and that your hosting provider has also set up a "wild-card" ServerAlias, so that requests for *any* subdomain are delivered to your "account" on that server. And these are good things, because it means that you *can* redirect those %20www requests to the proper "www" subdomain. You can test this by requesting "http://foo.example.com/" and see if that also resolves to your host and serves your home page.
If this is the case, then you can use either:
RewriteEngine on
RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST} !^www\.example\.com
RewriteRule (.*) http://www.example.com/$1 [R=301,L]
RewriteEngine on
RewriteCond %{HTTP_HOST} ^\%20www\.example\.com
RewriteRule (.*) http://www.example.com/$1 [R=301,L]
The first example says, "If the hostname is not blank and is not 'www.example.com', then redirect to www.example.com."
The second example looks specifically for requests using Google's malformed %20www subdomain, and redirects only those.
In both cases, the page requested by your visitor will be served, rather than the "home page."
Jim