I am attempting to write a 301 redirect which will take a look at both host title and also the query string parameter. Therefore if the URL is either of these two.

I Quickly would like it to redirect towards the appropriate page:

Otherwise, if host isn't example.com like

I Quickly don't want it to redirect.

This is exactly what I've to date, however it does not appear to operate. If anybody could provide a little of help on that one, it might be most appreciated. I already attempted to locate a similar answer however i could not locate one.

RewriteEngine on

RewriteCond %{HTTP_HOST} !^example.com$ [NC]
RewriteCond %{query_string} p=11&b=3
RewriteRule (.*) http://store.example.com/testpage.html [R=301,L]

You have to specify a clear query for the substitution URL:

RewriteCond %{HTTP_HOST} ^(www\.)?example\.com$ [NC]
RewriteCond %{QUERY_STRING} p=11&b=3
RewriteRule .* http://store.example.com/testpage.html? [R=301,L]

Otherwise the initial asked for query will get instantly appended towards the new URL.