Richard, thank you very much for you help, I really appreciate it.
Unfortunately, this is not solving problem, partly. I say partly, because your code is working on non-WordPress pages. Let's explain.
I tested this first on different site and then again on WordPress installation by creating empty folder called search. In both cases redirection worked. That means that server will redirect it only if there is page or folder called "search".
What I wanted in my case is to redirect it to my page on WordPress with URL domain.com/search which doesn't exists as page or folder, but it is dynamically created by WordPress (you understand thing). If I normally open that search with all that parameters via referral link or directly in address bar or via search form it works fine, but it seems that redirection doesn't works because server doesn't see that page "search" and because of that it gives 404 error.
How I actually succeed to redirect is from another domain or subdomain, by entering URL of site like in example below.
- Code: Select all
RewriteRule ^opensearch/?$ http://domain.com/search/?cx=017117527339218713940\%3Akjicmwrqgu4&cof=FORID\%3A11&ie=UTF-8&sa=%D0\%9F%D0%BE%D1\%82%D1\%80%D0%B0%D0%B6%D0%B8 [QSA,L]
(of course there was also rest of the code, but I pasted changed one)
I tried this on that WordPress installation but it didn't work, again I received 404 error.
So there are two possible solutions: to find way to redirect it as I intended or to create special subdomain just for it (let's say opensearch.domain.com) from which queries will be automatically redirected to right place.
But before on both solutions your decoding of parameters must be changed: when I succeed to redirect from other subdomain, instead of first URL I got second one and Google CSE won't work with it, it only fill search form on that page so user must again click on it.
- Code: Select all
http://domain.com/search/?cx=017117527339218713940%3Akjicmwrqgu4&cof=FORID%3A11&ie=UTF-8&sa=%D0%9F%D0%BE%D1%82%D1%80%D0%B0%D0%B6%D0%B8&q=keyword
http://domain.com/search/?cx=017117527339218713940%253Akjicmwrqgu4&cof=FORID%253A11&ie=UTF-8&sa=%25D0%259F%25D0%25BE%25D1%2582%25D1%2580%25D0%25B0%25D0%25B6%25D0%25B8&q=keyword
What is your suggestion about this?
Thanks again