重写规则代码不适用于深页
我编写一些重写规则,以操纵域地址之后的第一个文件夹,作为指示语言的查询字符串。
<rule name="en">
<match url="^en/(.*?/)" />
<action type="Rewrite" url="./{R:1}/?lang=en" />
</rule>
上面的代码适用于第一步文件夹:
http://example.com/en/members
Executes:
http://example.com/members/?lang=en
但不可行或更深入的步骤。
http://example.com/en/members/profile/
Executes:
http://example.com/members/?lang=en
第二步文件夹(配置文件)被忽略。
I write some rewrite rule to manipulate the first folder after domain address as a query string indicating the language.
<rule name="en">
<match url="^en/(.*?/)" />
<action type="Rewrite" url="./{R:1}/?lang=en" />
</rule>
The code above works for first step folders:
http://example.com/en/members
Executes:
http://example.com/members/?lang=en
but not or second and deeper steps.
http://example.com/en/members/profile/
Executes:
http://example.com/members/?lang=en
and the second step folder (profile) is being ignored.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的第一个规则也不起作用,因为参数
^en/(.*。
Your first rule shouldn't work either, because the parameter
^en/(.*?/)
doesn't matchen/members
, but you can try this rule: