I'm so new at mod_rewrite that I don't think I even know how to ask a question correctly. With help on this board I created an htaccess file that redirects URLs. Basically, any URL of the format "oldpage001.htm, oldpage002.htm, oldpage003.htm" gets redirected to "http://mynewdomain.com/newpage.htm" The htaccess for the above is: Options +Indexes Options +FollowSymlinks RewriteEngine on RewriteRule ^oldpage(.+)\.htm$ http ://mynewdomain.com/newpage.htm [R=301,L] Next, I created an htaccess file that stops thieves from hotlinking to my images. The htaccess for this is: Options +Indexes Options +FollowSymlinks RewriteEngine on RewriteCond %{HTTP_REFERER} !^$ RewriteCond %{HTTP_REFERER} !^http://(.+)\.mynewdomain.com(/)?.*$ [NC] RewriteCond %{HTTP_REFERER} !^http://(.+)\.google.com(/)?.*$ [NC] RewriteCond %{HTTP_REFERER} !^http://(.+)\.googlebot.com(/)?.*$ [NC] RewriteCond %{HTTP_REFERER} !^http://(.+)\.msn.com(/)?.*$ [NC] RewriteCond %{HTTP_REFERER} !^http://(.+)\.msnbot.msn.com(/)?.*$ [NC] RewriteCond %{HTTP_REFERER} !^http://(.+)\.inktomisearch.com(/)?.*$ [NC] RewriteCond %{HTTP_REFERER} !^http://(.+)\.looksmart.com(/)?.*$ [NC] RewriteCond %{HTTP_REFERER} !^http://(.+)\.ask.com(/)?.*$ [NC] RewriteCond %{HTTP_REFERER} !^http://(.+)\.exactseek.com(/)?.*$ [NC] RewriteCond %{HTTP_REFERER} !^http://(.+)\.searchit.com(/)?.*$ [NC] RewriteRule .*\.(gif|jpe?g|png|bmp)$ [F,NC] I tested each of these htaccess files separately and they both appear to work. Now what I want to do is place both of these rules into the same htaccess file. My result looks like this: Options +Indexes Options +FollowSymlinks RewriteEngine on RewriteCond %{HTTP_REFERER} !^$ RewriteCond %{HTTP_REFERER} !^http://(.+)\.mynewdomain.com(/)?.*$ [NC] RewriteCond %{HTTP_REFERER} !^http://(.+)\.google.com(/)?.*$ [NC] RewriteCond %{HTTP_REFERER} !^http://(.+)\.googlebot.com(/)?.*$ [NC] RewriteCond %{HTTP_REFERER} !^http://(.+)\.msn.com(/)?.*$ [NC] RewriteCond %{HTTP_REFERER} !^http://(.+)\.msnbot.msn.com(/)?.*$ [NC] RewriteCond %{HTTP_REFERER} !^http://(.+)\.inktomisearch.com(/)?.*$ [NC] RewriteCond %{HTTP_REFERER} !^http://(.+)\.looksmart.com(/)?.*$ [NC] RewriteCond %{HTTP_REFERER} !^http://(.+)\.ask.com(/)?.*$ [NC] RewriteCond %{HTTP_REFERER} !^http://(.+)\.exactseek.com(/)?.*$ [NC] RewriteCond %{HTTP_REFERER} !^http://(.+)\.searchit.com(/)?.*$ [NC] RewriteRule .*\.(gif|jpe?g|png|bmp)$ [F,NC] RewriteRule ^oldpage(.+)\.htm$ http ://mynewdomain.com/newpage.htm [R=301,L][/I] My question is, will the above htaccess file accomplish what I am attempting to do .. which is: 1. Stop people (except for mynewdomain, google, msn, etc) from hotlinking to my images *AND* 2. Redirect ALL urls of the type "oldpage001.htm, oldpage002.htm, oldpage003.htm" to the new url "http://mynewdomain.com/newpage.htm" REGARDLESS of where the request came from? (doesn't matter if it came from google, msn, yahoo, etc). I don't know if my last RewriteRule works correctly due to the RewriteCond lines that preceed it. Thanks to anyone who can understand and reply to my question.
as for me everything looks correctly. But probably the last line of the hotlink protection rules should be: RewriteRule .*\.(gif|jpe?g|png|bmp)$ - [F,NC]