且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

htaccess的删除查询字符串

更新时间:2023-11-15 16:34:49

如果您要删除所有的查询字符串,无论

If you want to remove all query strings regardless

RewriteCond %{QUERY_STRING} .
RewriteRule ^$ /? [R,L]

此测试,如果有任何查询字符串,然后重定向到主页上没有查询字符串 /

This tests if there is any query string . and then redirects to the home page without query string /?.

永远不要的测试与 301 启用,看到这个答案 提示调试的.htaccess重写规则的 了解详细信息。

Never test with 301 enabled, see this answer Tips for debugging .htaccess rewrite rules for details.