Forum Moderators: phranque

Message Too Old, No Replies

Combining RewriteConds

         

keyplyr

12:48 am on Dec 1, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



How would I merge the second RewriteCond into the first?

RewriteCond %{HTTP_REFERER}!^h*tp://66\.218\.(64¦[78][0-9]¦9[0-5])\.[0-9]{1,3}/search/cache.*www\.example\.com

RewriteCond %{HTTP_REFERER}!^h*tp://66\.102\.11\.104/search\?q=cache.*www\.example\.com

Thanks

jdMorgan

1:08 am on Dec 1, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



keyplyr,

The easiest way to do that is to take both strings and line up the common parts vertically, then drop anything that doesn't have to be kept (like the IP address parts) that is not common (X's in third line).


http://66\.218\.(64¦[78][0-9]¦9[0-5])\.[0-9]{1,3}/search/___cache.*www\.example\.com
http://66\.102\.11\.104__________________________/search\?q=cache.*www\.example\.com
________________________________________________________XXXX________________________

Combining the IP's that need to be kept by using "¦" and an outer set of parentheses, and replacing the thrown-away parts with ".*" gives:

http://66\.(218\.(64¦[78][0-9]¦9[0-5])\.[0-9]{1,3}¦102\.11\.104)/search.*cache.*www\.example\.com

Note that if you want to be more permissive, you *could* throw away the specific IP address, and just use the common part, "http:66\."

The funny thing is that I was thinking about doing this in my own files just this morning -- and probably for the same reason! :)

Jim