410 带有动态 GET 参数的重定向 url

希望a114y

需要从此页面重定向到410服务器响应 - http://example.com/product_info.php?products_id=1尝试了很多选项,但它们不起作用,例如:

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

对于这样的网址 - 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/*(.*) /$1$2 [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> 
希望a114y

工作变体:

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

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章