Forum Moderators: phranque
I'm new to all this htaccess and have read a few tutorials but I can't seem to find how to check for different suffixes for a domain.
I have rules for Google images as follows
RewriteCond %{HTTP_REFERER}!^http://images.google.fr/.*$ [NC]
RewriteCond %{HTTP_REFERER}!^http://images.google.at/.*$ [NC]
RewriteCond %{HTTP_REFERER}!^http://images.google.de/.*$ [NC]
RewriteCond %{HTTP_REFERER}!^http://images.google.nl/.*$ [NC]
RewriteCond %{HTTP_REFERER}!^http://images.google.ca/.*$ [NC]
RewriteCond %{HTTP_REFERER}!^http://images.google.se/.*$ [NC]
RewriteCond %{HTTP_REFERER}!^http://images.google.pl/.*$ [NC]
RewriteCond %{HTTP_REFERER}!^http://images.google.it/.*$ [NC]
RewriteCond %{HTTP_REFERER}!^http://images.google.fi/.*$ [NC]
RewriteCond %{HTTP_REFERER}!^http://images.google.sk/.*$ [NC]
RewriteCond %{HTTP_REFERER}!^http://images.google.be/.*$ [NC]
RewriteCond %{HTTP_REFERER}!^http://images.google.co.hu/.*$ [NC]
RewriteCond %{HTTP_REFERER}!^http://images.google.com/.*$ [NC]
is there a way I could make this into a single RewriteCond?
Thanks
Welcome to WebmasterWorld [webmasterworld.com]!
An example for your first four countries (add as many as you like, though):
RewriteCond %{HTTP_REFERER} !^http://images\.google\.(fr¦at¦de¦nl)/ [NC]
RewriteCond %{HTTP_REFERER} !^http://images\.google\.[a-z]{2}/ [NC]
You don't need ".*$" on the end; leaving the pattern unanchored means the same thing in this case.
Note that posting on this board changes the vertical pipe character to a broken pipe "¦". You will need to change them back to solid pipe characters before use.
Check our forum charter for a few useful reference links.
Jim