首页 > 解决方案 > 如何使用 htaccess 隐藏查询字符串

问题描述

当我将 301 链接重定向到新的 url 时添加了查询字符串,我想隐藏或删除它,我该怎么办。我的 .htaccess 喜欢:

 RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} !.*\.(ico|gif|jpg|jpeg|png|js|css)
    RewriteRule ^([^?]*) index.php?mod=mod&cmd=$1 [L]

    Redirect 301 /category1.html http://example.com/list/category1

结果:http://example.com/list/category1?mod=mod&cmd=list/category1

我希望它像这样显示:http://example.com/list/category1

谢谢大家。

标签: php.htaccess

解决方案


推荐阅读