正则表达式与重写规则的空字符串匹配是什么? [英] What is the regular expression to match the empty string for a rewrite rule?

查看:171
本文介绍了正则表达式与重写规则的空字符串匹配是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在iis7上重写规则的正则表达式,我正在尝试重定向
http:// www.website.com http://www.website.com/sample 。但是我只想要空的url字符串(如果你能用或不用'/'来计算它的额外点数),我不确定如何创建一个与之匹配的重写规则。

I need a regular expression for a rewrite rule on iis7, I'm trying to redirect http://www.website.com to http://www.website.com/sample. But I only want the empty url string (extra points if you can figure it out with and without '/'), and I'm unsure how to create a rewrite rule to match to that.

有人可以帮我吗?

推荐答案

^/?$

我认为......

这篇关于正则表达式与重写规则的空字符串匹配是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆