.htaccess 是否从url中删除整个查询字符串?

.htaccess 是否从url中删除整个查询字符串?,.htaccess,.htaccess,我正在尝试使用以下命令从url中删除整个查询字符串 RewriteRule ^/page /page? 但是它不起作用,为什么会发生这种情况 谢谢尝试使用以下方法: RewriteRule ^page page? 我建议你这样写你的重写规则: RewriteCond %{QUERY_STRING} !^$ RewriteRule ^page /page? [NC,R,L] 请记住,Apache在匹配重写规则中删除了前导斜杠/。希望这对您有所帮助 RewriteCond %{QUERY_ST

我正在尝试使用以下命令从url中删除整个查询字符串

RewriteRule ^/page /page?
但是它不起作用,为什么会发生这种情况

谢谢

尝试使用以下方法:

RewriteRule ^page page?

我建议你这样写你的重写规则:

RewriteCond %{QUERY_STRING} !^$
RewriteRule ^page /page? [NC,R,L]
请记住,Apache在匹配重写规则中删除了前导斜杠
/

希望这对您有所帮助
RewriteCond %{QUERY_STRING} !^$
RewriteRule ^page /page? [NC,R,L]