Which regular expression matches the empty string for the rewrite rule?

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

Can anyone help me out here?

+6
url regex iis-7 rewrite
source share
3 answers
^/?$ 

I think...

+18
source share

not quite sure what you are looking for, but this matches the empty URL bar:

HTTP // \ Z

+1
source share

The question is not very clear, but I think you want this:

^http://www.website.com/?$

^ and $ correspond to the beginning and end of a line. /? optionally matches the trailing slash.

+1
source share

All Articles