的.htaccess。 重定向具有“go”标记的网址

I'm having a pretty hard time on .htaccess URL rewrites in PHP. I want to put a specific condition to it but it has not worked out yet.

I WANT TO WRITE A CONDITION TO REDIRECT EVERYTHING THAT HAS A "GO" IN ITS URL

RewriteCond %{QUERY_STRING} ^.*&go=([^?&]*)\??([^&]*)&*.*$

Redirect /alice1.html http://www.google.com' the failed condition that i tried

FOR AN EXAMPLE IF SOMEBODY TYPES

'localhost/alice1.html' IT SHOULD NOT BE REDIRECTED TO google.com

BUT IF IT IS

'localhost//alice1.html?go=www.something_something.com'

THEN IT SHOULD BE REDIRECTED.

You can start from this base rule.

RewriteCond %{QUERY_STRING} \bgo=.+
RewriteRule . http://google.com? [L]

Then refine the checking of the go variable.

edit: note that this is just a template rule matching your input. On a production server it would be better to either set it as an external redirection (using [R=301, L] instead of just [L], assuming you want it permanent) or switch to an appropriate error page (403, 404...)