410 重定向 url 使用动态 GET 参数

410 redirect url with dynamic GET parameters

需要从该页面重定向到 410 服务器响应 - http://example.com/product_info.php?products_id=1 尝试了很多选项,但都没有用,例如这个:

RewriteCond %{QUERY_STRING} ^products_id=1$
RewriteRule ^.*$ - [G,NC]

对于 url 这样的 - http://example.com/?cat=79 工作变体:

RewriteCond %{QUERY_STRING} /?cat=79
RewriteRule .* - [G,NC]

因此这个也行不通

RewriteCond %{QUERY_STRING} /?products_id=1
RewriteRule ^.*$ - [G,NC]

.htaccess 文件:

AddDefaultCharset utf-8
ErrorDocument 404 /404.html
ErrorDocument 410 default
RewriteEngine On
RewriteBase /

#SEO
RewriteRule ^index\.php$ /? [L,R=301]

#10.01.2018 Redirect index.php to /
RewriteCond %{THE_REQUEST} ^GET.*index\.php [NC]
RewriteRule (.*?)index\.php/*(.*) / [R=301,L]

# PHP 5, Apache 1 and 2.
<IfModule mod_php5.c>
php_value magic_quotes_gpc                0
php_value register_globals                0
php_value session.auto_start              0
php_value mbstring.http_input             pass
php_value mbstring.http_output            pass
php_value mbstring.encoding_translation   0
php_value default_charset UTF-8
php_value mbstring.internal_encoding UTF-8
</IfModule> 

工作变体:

RewriteCond %{QUERY_STRING} (^|&)products_id\=1($|&)
RewriteRule .* - [G,NC]