What is the regular expression to match the empty string for a rewrite rule?
Question
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?
Solution
^/?$
I think...
OTHER TIPS
not exactly sure what your looking for but this matches an empty url strip:
http//\Z
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.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow