ISAPI 重写规则帮助 (http://www.foo.com/bar --> http://www.foo.com/bar.aspx)
这确实很简单,但我需要正确执行此操作,并且不能承受错误,因为我需要尽快在实时服务器上进行部署。
http://www.foo.com/bar --> http://www.foo.com/bar.aspx
http://www.foo.com/bar?q=boo --> http://www.foo.com/bar.aspx?q=boo
# I only want /bar to get rewritten to /bar.aspx
# everything else stays as is
http://www.foo.com/bar.aspx --> http://www.foo.com/bar.aspx
http://www.foo.com/bar.pdf --> http://www.foo.com/bar.pdf
我到达这里,但这将 bar.aspx
变成了 bar.aspx.aspx
,这不太好。
# Helicon ISAPI_Rewrite configuration file
RewriteEngine on
RewriteRule (.*) $1.aspx [L]
A really easy one, but I need to get this right, and cannot afford mistakes as I need to deploy on a live server as soon as I can.
http://www.foo.com/bar --> http://www.foo.com/bar.aspx
http://www.foo.com/bar?q=boo --> http://www.foo.com/bar.aspx?q=boo
# I only want /bar to get rewritten to /bar.aspx
# everything else stays as is
http://www.foo.com/bar.aspx --> http://www.foo.com/bar.aspx
http://www.foo.com/bar.pdf --> http://www.foo.com/bar.pdf
I got here, but this turns bar.aspx
into bar.aspx.aspx
, and that ain't good.
# Helicon ISAPI_Rewrite configuration file
RewriteEngine on
RewriteRule (.*) $1.aspx [L]
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试这个规则:
这应该避免任何可能的递归问题。如果您想排除已经存在的文件,请尝试以下条件:
Try this rule:
That should avoid any possible problems with recursion. And if you want to exclude already existing files, try this condition instead: