Forum Moderators: DixonJones
Is it possible to redirect the browser to a different URI (e.g. with HTTP headers) when sending back the IMG to the browser.
I have tried several methods. No success.
(Or maybe you have some other idea how to force such forgetful webmasters to remove the code from their pages if they do not read their e-mails.)
The problem here is that the browser will not be redirected to a different site/page. Only the <IMG> will be served from www.somewhere-else.com.
Please correct me if I have misunderstood something.
If you can identify the requesting page by referrer, you can use an internal redirect to return a 1x1 transparent GIF in place of the counter, or perhaps a replacement GIF with the word "Cancelled" in it.
Something like this:
RewriteCond %{HTTP_REFERER} ^http://www\.lazysite\.com [NC]
RewriteRule ^/cgi-bin/counter\.cgi /some_image_dir/transparent1x1.gif [L]
More info: Introduction to mod_rewrite [webmasterworld.com]
HTH,
Jim
Thanks. To return an image with the word "Cancelled" in it would be a good idea. But it does not work in my case. As you could see from my <IMG... code in my original post, it actually is the 1x1 GIF that I am returning to the IMG request. (It is only for the counting -- the counter is displayed with the help of another code)
If I would not have the WIDTH=1 and HEIGHT=1 specified in the IMG tag then I could return an image with the word "Cancelled" in it.
But as far as I know it is not possible to force the browser to ignore the WIDTH and HEIGHT specified in the IMG tag.
So, there could be at least two ways how to solve the problem:
FIRST: To redirect the client to another page (as a reminder for the forgetful webmaster)
SECOND: To return an image with the word "Cancelled" in it. But then I should try to force the browser to ignore the WIDTH and HEIGHT of the IMG tag.
If you have any ideas, please help me with this!
.
Well, I experimented with this for awhile, and what I find is that you have no good choices:
You can redirect to another image, but since the img attributes are 1x1, no-one will see it.
You can return a 403-forbidden code.
About the only thing I can think of is to do this:
RewriteCond %{HTTP_REFERER} ^(http://www.lazywebmaster1\.com) [NC,OR]
RewriteCond %{HTTP_REFERER} ^(http://www.lazywebmaster2\.com) [NC,OR]
RewriteCond %{HTTP_REFERER} ^(http://www.lazywebmaster3\.com) [NC]
RewriteRule ^/cgi-bin/counter\.cgi %1/please_remove_MartinK_counter_from_your_site.gif [R=301,L]
This will result in a request back to the cancelled-member-site for a gif image which does not exist. This will cause 404 errors in that site's error log until the counter image link is removed. However, there is still no guarantee that the webmaster will notice these errors.
HTH,
Jim
I presume you need to keep that code intact for existing users, so these solutions would require you to be able to identify the caller, i.e. calling page, you won't get this 100% of the time, but you'll get it 95% of the time.
Presuming that that's acceptable:
How about sending a HUGE image in terms of file size. The page would take forever to load. That might get noticed.
. . . Not very nice though.
Not nearly as in-your-face option
I'f the requested file currently has a compact P3P policy, you could take it out. That would throw a little privacy error for some browsers . . . not very likely to cause most webmasters any headaches . . . or to be noticed I suppose.
Those were very good suggestions.
I think I will use both of them: (1) redirect the request for the image back to [lazywebmaster3\.com...] and (2) send a special P3P header with HTTP.
Probably there is not much more to be said about it and I guess the issue is closed.