【问题标题】:How to remove query string using htaccess如何使用 htaccess 删除查询字符串
【发布时间】:2015-07-22 21:58:01
【问题描述】:

我的网址:example.com/epathasala/**schooldetails.php**?name=st-matthews-school example.com/epathasala/collegedetails.php?name=gtn-arts-college

预期网址: example.com/epathasala/**schooldetails**/st-matthews-school example.com/epathasala/collegedetails/gtn-arts-college

所以我想从 URL 中删除 ?name=,请帮助我。

在那个 url 查询字符串中只删除了。在我的情况下,查询字符串之前也有变化。

示例 Schooldetails 不是静态的,它会更改为 Collegedetails 或事件或大学等

【问题讨论】:

标签: regex .htaccess


【解决方案1】:

这也许能解决问题

RewriteEngine On
RewriteBase /
RewriteRule ^epathasala/schooldetails/(.*)$ /epathasala/schooldetails.php?name=$1 [NC,L]

【讨论】:

  • RamRaider 谢谢,但是 schooldetails 不是永久的,它是一个动态值,它可能会更改为 Collegedetails.php 或 events.php 或 university.php 等等
猜你喜欢
  • 2016-10-05
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-08-18
  • 1970-01-01
  • 2023-04-10
相关资源
最近更新 更多