Welcome to WebmasterWorld Guest from 54.211.135.32

Forum Moderators: Ocean10000 & phranque

Message Too Old, No Replies

Combining RewriteConds

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

Senior Member from US 

WebmasterWorld Senior Member keyplyr is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Sept 26, 2001
posts:12913
votes: 893


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
1:08 am on Dec 1, 2003 (gmt 0)

Senior Member

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Mar 31, 2002
posts:25430
votes: 0


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