需要有关 helicon isapi 和正则表达式规则的更多信息
我正在研究螺旋规则并尝试了各种组合,但它们不起作用
我希望解析以下 URL。
可能是这样
www.test.com/myownpages/
,或者
www.test.com/myownpages
www.test.com/myownpages/?value1=test2&value2=test2
应该解决为“
$1/test.aspx [NC]
如果有人在 myownpages 之后给出某些内容,它不应该起作用”
www.test.com/myownpages/test (This shouldn't work)
到目前为止,它尝试了以下方法
RewriteRule ^(.*)(\/\myownpages\/)(.*)(\?)?(.+)?$ $1/test.aspx [NC]
I am working on a helicon rule and tried various combinations but they didn't work
I want the following URL to be resolved.
It can be this
www.test.com/myownpages/
or
www.test.com/myownpages
www.test.com/myownpages/?value1=test2&value2=test2
it should be resolved to
$1/test.aspx [NC]
If anyone gives something after myownpages, it shouldn't work
www.test.com/myownpages/test (This shouldn't work)
It tried the below so far
RewriteRule ^(.*)(\/\myownpages\/)(.*)(\?)?(.+)?$ $1/test.aspx [NC]
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我不太熟悉这些重写规则,但也许我可以帮助解决正则表达式。当我阅读它时,您想要匹配任何以“/myownpages”、“/myownpages/”或“/myownpages/?anything”结尾的字符串,并捕获之前的部分。
我会用来
得到这个。 在 RegExr 中查看它的实际效果。 如果您需要转义正斜杠,它就会变成。
请注意,这不会保留查询字符串中的值;它将把
www.test.com/myownpages/?value1=test2&value2=test2
重写为www.test.com/test.aspx
。I am not very familiar with these rewrite rules, but maybe I can help with the regex. As I read it, you want to match any string ending with "/myownpages", "/myownpages/", or "/myownpages/?anything" and capture the part before that.
I'd use
to get this. See it in action at RegExr. If you need to escape the forward slashes, it becomes.
Note that this will not preserve the values in the query string; it will rewrite
www.test.com/myownpages/?value1=test2&value2=test2
towww.test.com/test.aspx
.如果您想从 /myownpages 重写(而不是重定向)--> /myownpages/test.aspx,尝试使用:
QSA-flag 自动将查询字符串附加到源路径。
In case you want rewrite (NOT redirect) from /myownpages --> /myownpages/test.aspx, try using:
QSA-flag appends the query string to the source path automatically.