.htaccess 多查询字符串参数的ISAPI重写规则

.htaccess 多查询字符串参数的ISAPI重写规则,.htaccess,isapi-rewrite,helicontech,.htaccess,Isapi Rewrite,Helicontech,我正在尝试使用HeliconTech ISAPI_rewrite Version 3用2个查询字符串参数重写URL。我可以用1个参数重写URL,但我无法找出重写2的规则 原始URL: http://example.com/index.php?id=1234&name=John-Edward-Smith 所需的重写URL http://example.com/id/1234/name/John-Edward-Smith 我当前的.htaccess: RewriteEngine On R

我正在尝试使用HeliconTech ISAPI_rewrite Version 3用2个查询字符串参数重写URL。我可以用1个参数重写URL,但我无法找出重写2的规则

原始URL:

http://example.com/index.php?id=1234&name=John-Edward-Smith
所需的重写URL

http://example.com/id/1234/name/John-Edward-Smith
我当前的.htaccess:

RewriteEngine On
RewriteRule   ^id/(.+)$  index.php?id=$1   [L, NC]

我当前的.htaccess文件成功重写了第一个参数(id)。我的问题是如何修改规则或添加额外的规则来重写第二个参数(名称)?

也许您可以尝试以下方法:

# Rewrite with the name
RewriteRule ^id/(\d+)/name/([a-z0-9-]+)$ index.php?id=$1&name=$2 [L,NC]

# Rewrite with only the ID
RewriteRule ^id/(\d+)$ index.php?id=$1 [L,NC]
应该是这样的:

RewriteRule ^id/(\d+)/name/([^./]+)$ index.php?id=$1&name=$2 [NC,L]
RewriteRule ^id/(\d+)$ index.php?id=$1 [NC,L]