.htaccess 规则,用于将 /node?page=31 重定向到站点的主页

.htaccess rule for redirecting /node?page=31 to the main page of the site

我需要找到 .htaccess 的重定向规则,它将重定向

/node?page=31/node/node?page=1/node/

但不是

/node/291 而不是 node/291/edit 因为它们的处理方式不同(见下文)

到我网站的主页(比方说 www.example.com

我在

下面有一个处理 /node/xxx 的规则

RewriteRule ^(../)?node/([0-9]+)$ noderedirect.php?nid= [L]

但我需要找到 /node?page 的规则,但我不知道该怎么做。

有人可以帮忙吗?

谢谢!

您可以在 DOCUMENT_ROOT/.htaccess 文件中使用此代码:

RewriteEngine On

RewriteCond %{QUERY_STRING} ^(page=(31|1))?$ [NC]
RewriteRule ^node/?$ /? [L,NC,R=302]