I need to redirect some URLS to one domain and all other urls to another one. For example the redirect code which should redirect mydomain.com/?p=221 and mydomain.com/?p=222 to Google and all other to another domain.
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} !\.(css|png|gif|jpe?g|js)$ [NC]
RewriteCond %{REQUEST_URI} !(?p=221|?p=222)& [NC]
RewriteRule ^(.*)$ http://mydomain.com/$1 [L,R=301]
RewriteCond %{REQUEST_URI} (?p=221|?p=222)& [NC]
RewriteRule ^(.*)$ http://google.com [L,R=301]
But the code doesn't work. Why is that?