php - 如何使用 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
谢谢大家。
解决方案
推荐阅读
- java - 验证用户字符串输入
- sql - 聚合函数内的 SQL 聚合函数
- python - Python:在 pyplot 图上绘制第二个 y 轴
- spring - 如何删除与另一个实体相关的实体
- java - Spring Thymeleaf - bean类错误的无效属性
- javascript - 如何使 JavaScript 变量完全不可变?
- javascript - 我正在尝试通过将参数传递给 fetch 调用来显示特定数据
- scala - 有什么方法可以捕获在 Spark 中使用通配符读取的多个镶木地板文件的输入文件名?
- c++ - 多长的 double 可以在 12 个字节中容纳这么多字符?
- python - 当值在每天 24 小时内至少一次超过阈值时,在每小时数据的 pandas 数据框中计算每年的天数