问题
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.
Can someone help me out here?
回答1:
^/?$
I think...
回答2:
not exactly sure what your looking for but this matches an empty url strip:
http//\Z
回答3:
The question isn't very clear, but I think you want this:
^http://www.website.com/?$
The ^
and $
match the beginning and end of the string.
The /?
optionally matches a trailing slash.
来源:https://stackoverflow.com/questions/1473632/what-is-the-regular-expression-to-match-the-empty-string-for-a-rewrite-rule