且构网

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

重写URL,以便查询字符串位于路径中

更新时间:2023-02-23 08:54:25

尝试以下方法:

RewriteRule ^faculty/index.php$ /faculty/%1? [R=302,L]

前导斜杠不在规则测试的URI路径中,因此也不能在正则表达式中.

The leading slash is not in the URI-path tested in the rule, so can't be in the regex either.

除非在规则中创建新查询,否则查询会自动附加到替代URL(不更改地传递),因此在使用规则时,尾随问号?会删除现有查询字符串.

As the query is automatically appended to the substitution URL (passed through unchanged) unless a new query is created in the rule, the trailing question mark ? erases the existing query string when the rule is used.