1

我有一个 URL,domain.com/fun/page/当查询字符串附加到它时我想重定向到它自己(domain.com/fun/page/?xyz)。

服务器是 LiteSpeed 并且无论如何(我已经尝试了在这里和网络上其他地方找到的许多规则),我没有得到我想要的。似乎我只是不擅长编写匹配的正则表达式。

4

1 回答 1

0

将此代码放入您的/fun/.htaccess文件中:

RewriteEngine On
RewriteBase /fun/

RewriteCond %{QUERY_STRING} .+
RewriteRule ^page/?$ %{REQUEST_URI}? [NC,R=302,L]

尾随?将剥离任何现有的查询字符串。

于 2014-06-25T07:30:56.897 回答