SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Member
    Join Date
    Nov 2010
    Location
    Melbourne, Australia
    Posts
    14
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Blocking access to a subfolder

    Hi Guys,

    I was hoping to have some assistance with an IIS7 web.config issue I was having.

    I am working on a PHP framework and wish to have most of the URL's passed to my index.php as the PATH_INFO. I would like not to invoke my index.php if the file exists (so go direct), but I would like to protect a sub-folder which is named WEB-INF (and all the contents below it).

    I currently have the web.config:

    Code XML:
    <?xml version="1.0" encoding="UTF-8"?>
    <configuration>
         <system.webServer>
             <rewrite>
                 <rules>
                     <rule name="Go direct on files and folders" stopProcessing="true">
                         <match url="^.*$" />
                         <conditions logicalGrouping="MatchAny">
                             <add input="{REQUEST_FILENAME}"
                                 matchType="IsFile" pattern=""
                                 ignoreCase="false" />
                             <add input="{REQUEST_FILENAME}"
                                 matchType="IsDirectory"
                                 pattern="" ignoreCase="false" />
                         </conditions>
                         <action type="None" />
                     </rule>
                     <rule name="Pass PHP the request PATH_INFO" stopProcessing="true">
                         <match url="^(.*)$" />
                         <action type="Rewrite" url="index.php/{R:1}" />
                     </rule>
                 </rules>
             </rewrite>
         </system.webServer>
    </configuration>

    I saw a reference website: http://learn.iis.net/page.aspx/143/u...est-filtering/ which looks like it might have some of the details in it, but I am not sure which particular function to use. Is it something to do with filtering out hidden segments?

    Thanks for the assistance.
    Last edited by Mittineague; Nov 30, 2010 at 13:13. Reason: reformatting bbcode tags

  2. #2
    SitePoint Member
    Join Date
    Nov 2010
    Location
    Melbourne, Australia
    Posts
    14
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Can someone assist by maybe suggesting where I should be posting this if this is not appropriate for this forum category? thanks!

  3. #3
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    16,445
    Mentioned
    160 Post(s)
    Tagged
    1 Thread(s)
    IMHO this is the best place here to ask about this. The Microsoft Rep comes by at least every third Friday so you may have to wait a while. Maybe another member that knows (there's a few) will stop by to help. Sorry, I'd try to help but I'm clueless about this one.

  4. #4
    Twitter: @AnthonySterling silver trophy AnthonySterling's Avatar
    Join Date
    Apr 2008
    Location
    North-East, UK.
    Posts
    6,111
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)

    Arrow

    I've queried a very nice acquaintance of mine...

    Quote Originally Posted by Anthony Sterling
    @juokaz Yo, is there any chance (pretty please) you could help @cammanderson with this teeny weeny IIS7 issue buddy? http://is.gd/i077q
    Quote Originally Posted by Juozas Kaziukėnas
    @cammanderson try this for your issue http://bit.ly/iiyw0L /cc @AnthonySterling
    Who kindly suggested...

    Code XML:
    <?xml version="1.0" encoding="UTF-8"?>
    <configuration>
        <system.webServer>
            <rewrite>
                <rules>
                    <clear />
                    <rule name="RequestBlockingRule1" patternSyntax="Wildcard" stopProcessing="true">
                        <match url="*" />
                        <conditions logicalGrouping="MatchAll">
                            <add input="{URL}" pattern="/**!!FOLDER NAME!!**" />
                        </conditions>
                        <action type="CustomResponse" statusCode="403" />
                    </rule>
                    <rule name="Imported Rule 1" stopProcessing="true">
                        <match url="^(.*)$" ignoreCase="false" />
                        <conditions logicalGrouping="MatchAll">
                            <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" pattern="" ignoreCase="false" />
                        </conditions>
                        <action type="Rewrite" url="app.php" appendQueryString="true" />
                    </rule>
                </rules>
            </rewrite>
        </system.webServer>
    </configuration>

    Which actually makes sense when you look at it. It's always the way!
    @AnthonySterling: I'm a PHP developer, a consultant for oopnorth.com and the organiser of @phpne, a PHP User Group covering the North-East of England.

  5. #5
    SitePoint Member
    Join Date
    Nov 2010
    Location
    Melbourne, Australia
    Posts
    14
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Awesome, thanks heaps!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •