Conditional mod_rewrite

General Discussion of atomic repo and development projects.

Ask for help here with anything else not covered by other forums.
NightStorm
Forum User
Forum User
Posts: 60
Joined: Sun Dec 05, 2004 4:16 am

Conditional mod_rewrite

Unread post by NightStorm »

Here's the situation... I'm feeling abnormally cruel this weekend, and want to mess with a few AOL users that visit a forum I'm on... so I have in my signature an image (a typical banner), but for these AOL users, I want them to see a different banner. The image is stored on my server, so I figured mod_rewrite in a .htaccess file would be the way to go (beats blocking their access all together).
Here is what I have going, but I need someone with experience with mod_rewrite to look it over and tell me what I might be missing that would cause it to only affect the users that fall into the listed IPs, and only if they call up the exact filename used in my signature...

Code: Select all

Options +FollowSymlinks
RewriteEngine on
RewriteCond %{REMOTE_ADDR} ^172\.128\. [OR]
RewriteCond %{REMOTE_ADDR} ^172\.129\. [OR]
RewriteCond %{REMOTE_ADDR} ^172\.130\. [OR]
... (there are more rules here, like the ones above and below)
RewriteCond %{REMOTE_ADDR} ^172\.189\. [OR]
RewriteCond %{REMOTE_ADDR} ^172\.190\. [OR]
RewriteCond %{REMOTE_ADDR} ^172\.191\. [OR]
RewriteCond %{HTTP_REFERER} ^http://www.forumdomain.com/.*$ [NC]
RewriteRule ^NS23\.jpg$ http://redirectimageURL [NC]
Post Reply