How to redirect all query string URLs of this type

I can't direct links followed by queries in PHP calls I would like to direct only some PHP pages I have urls that call certain php pages and are followed by query strings, https://hello.it/tr/wp-admin/admin-ajax.php?action=rest-nonce https://hello.it/wp-admin/admin-ajax.php?action=likeboxfrontend&TB_iframe=true&width=500&height=438 I would like to redirect these URLs to the main page of the site to delete them. I usually use this rule to create the query redirect and it works RewriteEngine On RewriteCond %{THE_REQUEST} /?paged=(.)=catelog_shop&id(.) RewriteRule ^(.+)$ /$1? [R=301,L] but if I add the example url it doesn't work anymore. RewriteEngine On RewriteCond %{THE_REQUEST} /\admin-ajax.php?action=(.*) RewriteRule ^(.+)$ /$1? [R=301,L] The point is that I want to create the redirect only for admin-ajax.php pages that have a query call. This rule for index.php example works RewriteEngine On RewriteCond %{THE_REQUEST} /\index.php?s=(.*) RewriteRule ^(.+)$ /$1? [R=301,L] but on other pages PHP does not work

Comment (0)

You’ll be in good company