redirectmatch没有参数?

时间:2017-10-11 14:45:57

标签: .htaccess redirect parameters

网址 www.ex.com/product_info.php?products_id=23&osCsid=1ed12

应重定向到www.ex.com/pagex.htm

我用

尝试了.htaccess

" RedirectMatch 301。" star" product_info.php" star" https://ex.com/pagex.htm" (其中" star" = *)

然后参数被转发到,所以 https://ex.com/pagex.htm?products_id=23&osCsid=1ed12

如何摆脱"?"和参数的一切东西?

1 个答案:

答案 0 :(得分:1)

RedirectMatch指令不会删除查询字符串。使用基于mod_rewrite的规则:

RewriteEngine On

RewriteRule ^/?product_info\.php$ https://ex.com/pagex.htm? [L,NC,R=301]

追踪?会剥离目标网址中的所有现有查询字符串。