Forum Moderators: phranque
I am trying to redirect an entire IP range using Apache 1.3
I can use this on my server with Apache 2
ReWriteCond %{REMOTE_ADDR} 1
ReWriteRule .* /cnn.html [L]
Which redirects all IP addresses that begin with the number 1
But this does not work on my server with Apache 1.3.
How can I redirect all users with an IP address that begins with 1 in Apache 1.3?
Thanks
Ex:
1)your missing 001 and 01[0-9].
2) your getting 1[0-9][0-9] which is 199 ranges in the Class A times 255 ranges in the Class B times 255 ranges in the Class C times 255 ranges in the Class D
The latter is quite a large range of visitors to take out (even for my sinister tastes)!
In addition, this code would cause an 'infinite' rewriting loop, rewriting /cnn.html to itself until the maximum internal rewrite limit was reached.
The proper code --if I understand your intent-- to externally redirect requests from IP addresses beginning with "1." to the /cnn.html file would be:
RewriteCond %{REMOTE_ADDR} ^1\.
RewriteCond $1 !^cnn\.html$
RewriteRule (.*) http://www.example.com/cnn.html [R=302,L]
For more information, see the documents cited in our forum charter [webmasterworld.com] and the tutorials in the Apache forum section of the WebmasterWorld library [webmasterworld.com].
Flush your browser cache completely before testing any changes to your code.
Jim
[edited by: jdMorgan at 10:16 pm (utc) on Jan. 10, 2008]
What you have is a thrice repeat of the same range.
To obtian what you desire? (against better judgement).
# 1, 10-19, 100-199 ranges of Class A
RewriteCond %{REMOTE_ADDR} ^(1¦1[0-9]¦1[0-9][0-9])\.
And I'm not all that positive about the first instance of the "1". (I'd feel much safer modifying that to [01]
In addition, you need to make corrections for the forums broken use of the pipe symbol, before using live.
Don