Running Laravel on Windows Azure Web Sites

A few days back I worked with a company that wanted to move their on-premises PHP solution to Windows Azure Web Sites. They are using Laravel ( as a framework for their solutions and they needed a quick and flexible way of publishing their sites to Windows Azure.

It turns out the solution to running Laravel on Windows Azure Web Sites was really quite simple: download the latest version of Laravel, add a web.config to the root of the unpacked ZIP-file to rewrite the URLs and upload to a Windows Azure Web Site via FTP. The web.config should have the following two rewrite rules:

<?xml version="1.0" encoding="utf-8"?>
        <rule name="RewriteRequestsToPublic">
          <match url="^(.*)$" />
          <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
          <action type="Rewrite" url="public/{R:0}" />
        <rule name="Imported Rule 1" stopProcessing="true">
          <match url="^(.*)$" ignoreCase="false" />
          <conditions logicalGrouping="MatchAll">
            <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
            <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
          <action type="Rewrite" url="public/index.php/{R:1}" appendQueryString="true" />