Deploying Laravel Applications to Windows Azure – URL Rewriting

This is just a quick one for reference purposes. You can use Laravel 4 on Windows Azure Websites, but you’ll need to rewrite the urls similarly to you would with apache. Create a file named web.config and drop it into the root of your website (or Github repository if you are deploying from there). This assumes your laravel public directory is src/public .

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.webServer>
    <rewrite>
      <rules>
        <clear />
        <rule name="TransferToPublic" stopProcessing="true">
          <match url="^(app|assets|css|fonts|images|js|packages|favicon.ico)(.*)$" />
          <action type="Rewrite" url="src/public/{R:0}" />
        </rule>
        <rule name="Rewrite requested file/folder to index.php" stopProcessing="true">
          <match url="^(.*)$" ignoreCase="false" />
          <action type="Rewrite" url="src/public/index.php/{R:0}" appendQueryString="true" />
        </rule>
      </rules>
    </rewrite> 
  </system.webServer>
</configuration>
22
Aug 2013
POSTED BY
POSTED IN Azure Laravel
DISCUSSION 3 Comments
TAGS

  • Dustin Fraker

    When I try to do composer create-project … on azure I get an error: proc_open not enabled on your version of php. Is there some easy way to fix that issue that you know of?

    • No, unfortunately not. I ran into the same issue and I believe it’s from a recent update to a component within the symfony framework which requires proc_open (which isn’t available on windows by default).

      In the end I moved off Azure and onto http://fortrabbit.com/.

  • Dustin Fraker

    So I was able to get around this issue by installing a new build of php on windows azure. The process was simple but difficult because they don’t have much documentation on it and no one on the web is really talking about it. Maybe I’ll do a blog on how I did it. If I do I’ll post a link here. Thanks for the article, azure is pretty awesome and way cheaper than fortrabbit.