I dont’t think that will work, since the URLs have query strings and RewriteRule’s wont work. I think I need a RewriteCond, but I’m not sure how I’d match any URLs with ‘catalogsearch in them and redirect to the root domain…’
Is there not an easier way of just matching the word ‘catalogsearch’ in the URL (http://www.example.co.uk/catalogsearch/blah/blah?id=1234567) and redirecting? Some URLs might differ in terms of the query string parameters, so I’d just like to match anything with catalogsearch, which is always first in the URL params.
I need to be able to detect the ‘catalogsearch’ string in the URL, if I find it, redirect to http://www.example.co.uk - unfortunately, your example did not do this.
I believe that will also kill the query string but not sure about this factor.
Adam,
NEVER leave <IfModule> tests in place on a production server as they will KILL the server’s performance.
As the other responder pointed out, the query string is unaffected by a mod_rewrite directive (which does not alter the query string). Also, the query string can be removed by adding a ? after the redirection - but, when mod_alias’s Redirect is the proper Apache tool to use and it doesn’t forward the query string, why bother? I’m a real fan of the power of mod_rewrite but the most important thing to understand is when to use it and when not to use it. Here, it’s better to use the proper tool: mod_alias’s Redirect.