« Previous Next »

Thread: IIS rewrite help!

Last post 07-20-2009 7:09 PM by mttd. 3 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (4 items)

Sort Posts:

  • 07-20-2009, 3:01 AM

    • mttd
    • Not Ranked
    • Joined on 07-20-2009, 2:57 AM
    • Posts 2

    IIS rewrite help!

     hi all,

    i have installed mod rewrite and was just look for a bit of help regarding the pattern as I haven't quite got the hang of RegEx yet!!!

    I have a site the requires redirection based on whether there is a file in that dir or not, if there isn't then it means the file is in the shared dir and thus isn't specific to the section of the site...here's an example...

     

    URL: /NSW/Register.aspx (this is a shared file used by 3 other states)

    Redirect: /Shared/Register.aspx

     but it is not limited to only that page, as I say it needs to check if the file exists and redirect if it's not...is this possible?

     

    thanks a lot in advance!!

    tom

  • 07-20-2009, 12:52 PM In reply to

    • ruslany
    • Top 25 Contributor
    • Joined on 07-01-2007, 7:38 PM
    • Redmond, WA
    • Posts 664

    Re: IIS rewrite help!

    You can use conditions with {REQUEST_FILENAME} to check whether requested URL is a file, e.g.:

     <condition input="{REQUEST_FILENAME}" matchType="IsFile" />

    http://ruslany.net
  • 07-20-2009, 4:47 PM In reply to

    • DanielVL
    • Top 75 Contributor
    • Joined on 10-07-2006, 6:00 PM
    • Redmond, WA, USA
    • Posts 109

    Re: IIS rewrite help!

    Just as a tip, you could also write:

    <condition matchType="IsFile" />

    The input value will be defaulted to {REQUEST_FILENAME}.

     

    Daniel Vasquez Lopez
    URL Rewrite Engine Developer
  • 07-20-2009, 7:09 PM In reply to

    • mttd
    • Not Ranked
    • Joined on 07-20-2009, 2:57 AM
    • Posts 2

    Re: IIS rewrite help!

     ahh, thanks to you both for posting on this. i am assuming this goes in the web.config?

    sorry i've not setup mod_rewrite on an IIS environment before, so am not compeltely au fait with it all!

     

    also, how would I be able to specify to redirect to the shared dir if it is not a file?

     

    thanks again!

    tom

Page 1 of 1 (4 items)
Microsoft Communities