I have just upgraded my website, and set 301 redirects for all old pages. But on the old website I used a search engine, and in Google Webmaster there are loads of 404 pages with search queries. They look like this: www.mydomain.com/search.php?filter=monitor&q=merchant&sort=price Simply redirecting search.php doesn't help, so I guess I need to use a wildcard? I have never done anything like this, so maybe someone can tell me how to do this? Thanks!
Try using this: RewriteEngine On RewriteCond %{QUERY_STRING} ^filter=(.*)&q=(.*)&sort=(.*)$ [NC] RewriteRule ^search.php$ /your-new-search-url/filter-%1/q-%2/sort-%3/? [L,R=301] Code (markup): Above snippet will redirect all your search queries to your new url along with entered parameters. So in the line 3 you need to change the last part to your actual url. In the case you just want to redirect all those pages and cut off old queries then replace line 3 with this one: RewriteRule ^search.php$ /your-new-search-url/? [L,R=301] Code (markup):