1

I need a help with Regex on URL rewrite module.

I want to apply a rule for the home page.

I tried with ^default.aspx, which is working fine when user access the site with /default.aspx

But normally users are accessing the site with / (www.website.com/) so I am trying to write the reqex and not able to find the correct one.

I tried lot of different combination but nothing worked so far.

^(/default.aspx|$|/$)
^(|/|/default.aspx)

Thanks for the help

5
  • Thanks I removed the ^, but still it is not working. By not working I mean, the rule is applied for other pages also. like www.website.com/aboutus.aspx this page also not got the rule applied. I want the rule only for home page. Thanks Commented May 18, 2013 at 10:15
  • 1
    you should properly specify your rule in the question Commented May 18, 2013 at 10:16
  • Thanks for the comments. As I mentioned my requirement is to apply the rule for homepage alone. Commented May 18, 2013 at 10:20
  • 1
    you can try ^(www.website.com/)?(/?default.aspx|/)$ Commented May 18, 2013 at 10:29
  • Thanks. This one is working fine for www.website.com/default.aspx, but it is not working www.website.com/ Commented May 18, 2013 at 16:05

1 Answer 1

1

You could use the following pattern:

^(/|default.aspx)?$

It will match /, default.aspx or nothing

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.