while($alive) LiveAndLearn();

JavaScript, PHP, C# and Life in Viet Nam

Setup Recess Framework on Windows 7 using IIS 7

with one comment

I’ve played with Recess Framework for some time, it’s a RESTful PHP framework, which takes care of quite a bit of the boring stuff, so it makes it more fun to work with, at least for me, I don’t like boring stuff icon smile Setup Recess Framework on Windows 7 using IIS 7

I didn’t find any information about how to setup the Recess Framework properly under IIS 7, so here goes a quick guide in few words and some pictures.

This guide assumes that you have already followed Kris Jordan’s initial installation guide, and that a new web site is configured under IIS pointing to the root folder of your Recess installation.

Using your favorite browser to access your installation, if you are just as lucky as I was, you will get a page that looks somewhat like the image below, when you click on the link to Recess Tools:

1 iis before Setup Recess Framework on Windows 7 using IIS 7

No CSS is applied, the problem seems to be that index.php is not removed properly, this is caused by missing rewrite rules which should be configured for the web site through IIS Manager, so open the URL Rewrite tool by double-clicking on the icon:

2 iis rewrite url Setup Recess Framework on Windows 7 using IIS 7

The URL Rewrite module allows you to import .htaccess files, so click on Import Rules… in the right pane:

3 iis import rules Setup Recess Framework on Windows 7 using IIS 7

Locate the root folder for your Recess installation and choose the .htaccess file and click import:

4 iis select htaccess Setup Recess Framework on Windows 7 using IIS 7

The .htaccess file is parsed and you get a chance to preview the rules before you Apply:

5 iis review apply Setup Recess Framework on Windows 7 using IIS 7

Completing the above steps should be enough to get URL rewriting up and running under IIS 7, and with your favorite browser Recess Tools should now appear familiar:

6 iis after Setup Recess Framework on Windows 7 using IIS 7

Hope you have fun as much fun as I have using the Recess Framework!

Note: When you are deploying to a hosting solution running on Windows severs it’s highly unlikely that you have access to the IIS Manager. That might not be a problem, depending on your host of course, because all the rewrite rules are placed in a special section in the web.config file for the web site.

This is what my web.config file for Windows hosting looks like:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
   <system.webServer>
      <rewrite>
         <rewriteMaps>
            <rewriteMap name="Recess">
               <add key="^([^.]+)$ $1.html [QSA]" value="^(.*)$ bootstrap.php [QSA,L]" />
            </rewriteMap>
         </rewriteMaps>
         <rules>
            <rule name="Imported Rule 1">
               <match url="^([^.]+)$" ignoreCase="false" />
               <action type="Rewrite" url="{R:1}.html" appendQueryString="true" />
            </rule>
            <rule name="Imported Rule 2" stopProcessing="true">
               <match url="^(.*)$" ignoreCase="false" />
               <conditions logicalGrouping="MatchAll">
                  <add input="{REQUEST_FILENAME}" matchType="IsFile"
                       ignoreCase="false" negate="true" />
               </conditions>
               <action type="Rewrite" url="bootstrap.php" appendQueryString="true" />
            </rule>
         </rules>
      </rewrite>
      <directoryBrowse enabled="false" />
      <defaultDocument>
         <files>
            <clear />
            <add value="Default.htm" />
            <add value="Default.asp" />
            <add value="Default.aspx" />
            <add value="index.htm" />
            <add value="index.html" />
            <add value="index.php" />
            <add value="index.asp" />
            <add value="index.aspx" />
         </files>
      </defaultDocument>
   </system.webServer>
</configuration>

Some references:
http://learn.iis.net/page.aspx/557/translate-htaccess-content-to-iis-webconfig
http://learn.iis.net/page.aspx/470/importing-apache-modrewrite-rules

share save 171 16 Setup Recess Framework on Windows 7 using IIS 7

One Response to 'Setup Recess Framework on Windows 7 using IIS 7'

Subscribe to comments with RSS or TrackBack to 'Setup Recess Framework on Windows 7 using IIS 7'.

  1. Yo! That really helped, thanks Thomas!

    WebMinder

    20 Oct 10 at 17:06:23

Leave a Reply

Switch to our mobile site