locked
How to rewrite rule in web.config file RRS feed

  • Question

  • User-727257783 posted

    Need one help. we have one rule rewritten like this in the web.config file.

    <DomainRedirectRule> <LookFor>http://(www.)?sitename.com(/)?(default.aspx)?</LookFor> <SendTo>http://www.sitename.com/test</SendTo> </DomainRedirectRule>

    Now the new requirement is when some one enter http://sitename.com/asdf it should go to the destination url instead of returning 404 page.

    Can somebody please advise how should i rewrite the above the rule to make this happen.

    Thank you for your time and help.

    Monday, April 1, 2013 3:08 PM

Answers

  • User1508394307 posted

    Did you try

    <DomainRedirectRule>
        <LookFor>http://(www.)?sitename.com/asdf</LookFor>
        <SendTo>http://www.sitename.com/test</SendTo>
    </DomainRedirectRule>

    Hope this helps.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, April 1, 2013 4:09 PM

All replies

  • User1508394307 posted

    Did you try

    <DomainRedirectRule>
        <LookFor>http://(www.)?sitename.com/asdf</LookFor>
        <SendTo>http://www.sitename.com/test</SendTo>
    </DomainRedirectRule>

    Hope this helps.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, April 1, 2013 4:09 PM
  • User228685309 posted

    You could try with http://(www.)?sitename.com(/|default.aspx)?$ in your LookFor rule. My guess is that with the $ symbol, it would match only the addresses that ends up with what you're trying to express.

    Sunday, April 21, 2013 12:40 PM