Forum Moderators: open

Message Too Old, No Replies

Cloaking for just one human

By IP address

         

anallawalla

2:24 am on May 2, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



I have one visitor from a fixed IP address whom I'd like to serve a special Welcome page. How can I do this?

DaveAtIFG

1:12 pm on May 2, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If you're using Apache, including the following in your .htaccess should do it:

RewriteCond %{REMOTE_ADDR} XXX.XXX.XXX.XXX
RewriteRule ^index\.html$ special.html [L]

anallawalla

5:27 am on May 3, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



Thanks, but it did not work. I also tried something suggested a while ago here [webmasterworld.com] but it did not work. I tested using the IP address presently seen by my router from the ADSL ISP.

I don't have access to httpd.conf as it is a web host site but I can use .htaccess.

My .htaccess looks like this (tried all combinations between your and the other recommendation, e.g. escaping the dots, ^, $ but to no avail):

<Limit GET HEAD POST>
SetEnvIfNoCase User-Agent "Indy Library" bad_bot
SetEnvIfNoCase User-Agent "Internet Explore 5.x" bad_bot
SetEnvIf Remote_Addr "195\.154\.174\.[0-9]+" bad_bot
SetEnvIf Remote_Addr "211\.101\.[45]\.[0-9]+" bad_bot
order allow,deny
allow from all
deny from 211.157.
deny from 63.226.18.204
deny from 61.177.
deny from 67.80.16.
Deny from env=bad_bot
</LIMIT>
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{REMOTE_ADDR} xxx.xx.xxx.xxx
RewriteRule ^index\.shtml$ test.shtml [L]

Any ideas? I want to test with my own address before assuming it will work for another site. Reading the apache.org docs makes me none the wiser.

anallawalla

5:48 am on May 3, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



As another test, I tried adding my own IP address to the deny list but it does not deny me. What does that say about my host's Apache config?

.htaccess works fine for 301 redirects from this site.

- Ash

jdMorgan

6:27 am on May 3, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Ash,

Make sure you've added the anchors and escaped the periods in the IP address as in the example shown. Also, add a preceding slash to "test.shtml"


Options +FollowSymLinks
RewriteEngine on
RewriteCond %{REMOTE_ADDR} ^123\.45\.67\.89$
RewriteRule ^index\.shtml$ /test.shtml [L]

Now this should work if you request exactly "yourdomain.com/index.shtml" from the IP address given in the RewriteCond. If it doesn't work, then there is something wrong with your setup - perhaps mod_rewrite is not installed on your server, or you are attempting to test this in a subdirectory, or something else is wrong.

Jim

anallawalla

7:45 am on May 3, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



Jim,

You're a legend! Thanks!

The / before the alternative page did it. The site search has so many examples, but none that I sampled worked because each was trying to do something different.

Here is the final code that works. For a visitor from 123.123.123.123 who comes to my site, the test.shtml page is displayed instead of index.shtml:

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{REMOTE_ADDR} ^123\.123\.123\.123$
RewriteRule ^index\.shtml$ /test.shtml [L]

- Ash