Search This Blog


Sunday, April 21, 2013

Laravel php framework on IIS7

I've been testing laravel to run in IIS7 recently, and I was surprise to know that is quite very easy to achieved. Before, I had a hard time setting up cakephp projects to run in IIS and I thought it would be the same for laravel surprisingly its not.

What I outline here is basically setting up the laravel framework to run on IIS7.

>> Windows OS
>> IIS7
>> IIS URL rewrite
>> latest laravel framework
 you can download laravel framework laravel web site

1. Download the laravel.
2. Extract the downloaded file to C:\Inetpub\wwwroot\
3. Rename the extracted folder to laravel
4. Run inetmgr.exe program
5. Navigate to your default site. In our case we shall navigate to laravel
6. Select the URL Rewrite

7. In the action pane click import rules
8. In the rules to import click the ... button

9. C:\Inetpub\wwwroot\laravel\public
10. Select .htaccess file
11. Click Import
12. In action pane click apply
13. This routine shall create a web.config file in our root.

My web.config file is something like below

<?xml version="1.0" encoding="UTF-8"?>
                <clear />
                <add value="index.php" />
                <add value="default.aspx" />
                <add value="Default.htm" />
                <add value="Default.asp" />
                <add value="index.htm" />
                <add value="index.html" />
        <handlers accessPolicy="Read, Execute, Script" />
                <rule name="Imported Rule 2" stopProcessing="true">
                    <match url="^(.*)$" ignoreCase="false" />
                    <conditions logicalGrouping="MatchAll">
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
                    <action type="Rewrite" url="public/{R:1}" />

Testing our site

In your web browser type localhost/laravel/

If everything is set right you will see a similar page shown below