Forum Moderators: phranque
If the user visit www.others.com, i will display a static page to tell the user to use the correct url to visite www.example.com.
Any tips? Thanks.
Alternatively, you could try getting in touch with the hosting provider of www.others.com and let them know - try a WHOIS lookup on that domain. The hosting provider *might* do something about it, even though there's no obligation for them to do so.
Finally, you might just leave it - you are getting free traffic?
RewriteCond %{HTTP_REFERER} ^http://(www\.)?others\.com
RewriteCond $1 !^your-message-page-here\.html$
RewriteRule ^(.+\.html)$ /your-message-page-here.html [L]
Jim
<VirtualHost _default_:80>
ProxyRequests off
Options +SymLinksIfOwnerMatch
RewriteEngine on
RewriteCond %{HTTP_REFERER} ^http://www\.others\.com/(.*)$ [NC]
RewriteRule .* http://www.example.com/redirect/domain_jump.html [L]
RewriteLog logs/meatball_rewrite_log
RewriteLogLevel 0
...
</VirtualHost>
Open it, then visit www.others.com and you will see exactly what they send to your browser and what your browser sends to your site.
[others.com...]
GET / HTTP/1.1
Host: www.others.com
User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.0.1) Gecko/2008070206 Firefox/3.0.1
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-ecve: 300
Connection: keep-ecve
HTTP/1.x 301 Moved Permanently
Date: Fri, 25 Jul 2008 11:13:10 GMT
Server: Apache/2.0.52 (Unix)
Location: http://www.example.com/
Content-Length: 238
Keep-ecve: timeout=5, max=300
Connection: Keep-ecve
Content-Type: text/html; charset=iso-8859-1
----------------------------------------------------------
http://www.example.com/
GET / HTTP/1.1
Host: www.example.com
User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.0.1) Gecko/2008070206 Firefox/3.0.1
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-ecve: 300
Connection: keep-ecve
Cookie: ec_apache_id=172.16.**.192.72031713509689.9; __cookie_client_data__=HEh8JXBg2BsY5bS7w4zwRs8J1Pal/HHe68QEYDTH/JEYjvc2cwDvtIjsACgBpVlcCIMtm9ryd/Ne9SAlbgqn2sioYwds9dZy; ec_apache_track=; ystat_cn_ss_488177=22_17867566_592976912; ec_apache_sid=172.16.60.195.00862878276476.0¦1216986162; _intl_temp_other_=w0ER0RhW1plXntR/97cJxJ/rwza32M8hvMwCJAF/EMNGXJhOQjdtBhT9tWE1xmjD; ec_apache_tracktmp=; _others_session=BAh7ByIKZmxhc2hJQzonQWN0aW9uQ29udHJvbGxlcjo6Rmxhc2g6OkZsYXNo%250ASGFzaHsABjoKQHVzZWR7ADoMY3NyZl9pZCIlNGRmYjUwOTk3ZmZjOWE0MjJk%250AY2IzN2FjODk5MTNlNGE%253D--dacd19605daca78f61ce0ede18e5879cbf437763
If-Modified-Since: Fri, 25 Jul 2008 09:53:39 GMT
If-None-Match: "4889a2a3-fb69-20f05f"
HTTP/1.x 304 Not Modified
Date: Fri, 25 Jul 2008 11:13:14 GMT
Connection: Keep-ecve
Keep-ecve: timeout=5, max=100
Etag: "4889a2a3-fb69-20f05f"
Set-Cookie: ec_apache_sid=172.16.**.195.00862878276476.0¦1216986194; path=/; domain=.example.com
[edited by: jdMorgan at 11:53 am (utc) on July 25, 2008]
[edit reason] Obscured IP address [/edit]
Just the client ask that. I have to told him, there is no way to do that :-).
The request from others.com:
http://www.example.com/
GET / HTTP/1.1
Host: www.example.com
User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.0.1) Gecko/2008070206 Firefox/3.0.1
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-ecve: 300
Connection: keep-ecve
Cookie: ec_apache_id=172.16.**.192.72031713509689.9; __cookie_client_data__=HEh8JXBg2BsY5bS7w4zwRs8J1Pal/HHe68QEYDTH/JEYjvc2cwDvtIjsACgBpVlcCIMtm9ryd/Ne9SAlbgqn2sioYwds9dZy; ec_apache_track=; ystat_cn_ss_488177=28_17868470_592976912; ec_apache_sid=172.16.60.195.00862878276476.0¦1216987066; _intl_temp_other_=w0ER0RhW1plXntR/97cJxJ/rwza32M8hvMwCJAF/EMNGXJhOQjdtBhT9tWE1xmjD; ec_apache_tracktmp=; _ecxueyuan_session=BAh7ByIKZmxhc2hJQzonQWN0aW9uQ29udHJvbGxlcjo6Rmxhc2g6OkZsYXNo%250ASGFzaHsABjoKQHVzZWR7ADoMY3NyZl9pZCIlNGRmYjUwOTk3ZmZjOWE0MjJk%250AY2IzN2FjODk5MTNlNGE%253D--dacd19605daca78f61ce0ede18e5879cbf437763
The request from example.com:
http://www.example.com/
GET / HTTP/1.1
Host: www.example.com
User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.0.1) Gecko/2008070206 Firefox/3.0.1
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-ecve: 300
Connection: keep-ecve
Cookie: ec_apache_id=172.16.**.192.72031713509689.9; __cookie_client_data__=HEh8JXBg2BsY5bS7w4zwRs8J1Pal/HHe68QEYDTH/JEYjvc2cwDvtIjsACgBpVlcCIMtm9ryd/Ne9SAlbgqn2sioYwds9dZy; ec_apache_track=; ystat_cn_ss_488177=26_17868329_592976912; ec_apache_sid=172.16.60.195.00862878276476.0¦1216986994; _intl_temp_other_=w0ER0RhW1plXntR/97cJxJ/rwza32M8hvMwCJAF/EMNGXJhOQjdtBhT9tWE1xmjD; ec_apache_tracktmp=; _ecxueyuan_session=BAh7ByIKZmxhc2hJQzonQWN0aW9uQ29udHJvbGxlcjo6Rmxhc2g6OkZsYXNo%250ASGFzaHsABjoKQHVzZWR7ADoMY3NyZl9pZCIlNGRmYjUwOTk3ZmZjOWE0MjJk%250AY2IzN2FjODk5MTNlNGE%253D--dacd19605daca78f61ce0ede18e5879cbf437763
[edited by: jdMorgan at 11:54 am (utc) on July 25, 2008]
[edit reason] Obscured IP address [/edit]
The way I do this is to rewrite the request (using mod_rewrite in my main .htaccess file) to a special subdirectory. In that subdirectory, I create a .htaccess file that defines the 403 error page for that subdirectory (using ErrorDocument). Then I use mod_access Allow and Deny directives to forbid access to any file in that special subdirectory except the 403 errordocument itself.
So, any request that is rewritten to that subdirectory gets a "special" 403 error page, different from the main 403 error page used for the rest of the site.
There are a couple of applications for this technique. First, in cases like yours, you can send a customized error document based on the client request's HTTP_Referer, IP address, etc. And second, for known bad 'bots and abusive/malicious visitors, you can send a very short or even 0-byte 403 message body to save on wasted bandwidth.
This technique might be useful to you, depending on exactly what it is that you hope to accomplish.
Jim
As with any HTTP Referer-based access control, this method is not 100% effective, since the Referer is an optional header. But often it can be "effective enough."
Jim
which engines do fix that?
This is my question. There is no evidence for distinguish the two requests.
In order to distinguish the two requests, you have to have requests in which the HTTP Referer: header was included. If the client does not send a referrer, then you cannot distinguish them... Sometimes clients send a referrer, and sometimes they don't -- It is up to the client (and the 'user') whether to send the Referer: header. And in some cases, even if the client sends the Referer: header, it can be blocked or removed by an intervening corporate or ISP proxy, over which the user has no control.
janharders is right, in that much of the time, even if you have the referrer, there still isn't enough information to make a decision. However, if you can catch just a few of these unwelcome referrers, then you can sometimes "make enough trouble" for the Webmaster of the site that is redirecting to you to make him remove the redirect.
As it stands, be grateful this is a 301 redirect (which tells the search engines to "remember" *your* URL). If it were a 302, then you might be in the mess that was discussed at length last year here on WebmasterWorld, with 302 "page-hijacking."
Jim