2

I am trying to redirect all query strings to a new URL.

Search query example www.example.com/?s=cars to resolve to www.example.com/?search_gcse/?q=cars ("cars" is just an example).

What is the syntax for the .htaccess rule?

0

1 Answer 1

3

Partly depends on which question mark you want to keep. You have two question marks in the URL that you're trying to resolve to & that won't work. I'll assume that the last question mark is the one you want to keep

RewriteCond %{QUERY_STRING} (?:&|^)s=(\w+)
RewriteRule ^ http://www.example.com/search_gcse/?q=%1 [R=302,L]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.