> > https://example.com/search?searchword=CVE-2021-4014&Search= >> >> I've tried the following RewriteCond/RewriteRule in various forms, but not >> sure what I'm doing wrong. >> >> RewriteCond %{QUERY_STRING} ^searchword=(.*) >> RewriteRule ^ q=$1 [NC,L] >> >> Ideas for what I'm doing wrong would be greatly appreciated. >> >> Is the query parameter case sensitive? That’d be important for > RewriteCond to know. Also, isn’t that the “starts with” operator, ^? What > if the parameter comes second? A bit verbose, but: > > ^.*searchword=(\w{1})[&]{0,1}.*$ >
Whoops, meant to add a comma in the capturing group. Also the end is ambiguous. Maybe searchword=(\w{1,}) Should match all the way to the end of the query value (& is not in \w), or the end the query string if it’s the last parameter. >