
Laravel has become a leading PHP framework because of its many significant features. When deploying to Azure, there are a few nuances. Here we attempt to cover them.Steps for Laravel on Azure:
1. Install PHP version >= 5.4Laravel5 requires PHP version >= 5.4. Azure provides an option to install the needed PHP version as per our project. To change the PHP version in Azure, follow the below steps

2. Install ComposerComposer is an important package manager in PHP. It is mainly used with Laravel for package management. A composer can be easily installed on Azure via its extension manager.

3. Perform Directory SetupDirectory setup is an important process in Laravel projects. Laravel lifecycle always starts from the file `public/index.php`. Azure deploys everything you push into the `www root` directory.To change the project start up point in Azure, follow the below steps:

4. URL RewritingGenerally, if we type an invalid URL on a laravel based site, we get redirected to 404 page.This occurs because of URL mod_rewrite rule.Laravel assumes that it is dealing with an Apache Web-Server, therefore it processes the mod_rewrite rules specific to that.But Azure Web Apps use Microsoft's IIS.Hence, we need to include the below-mentioned changes for URL rewriting.Create a new file called web.config in public directory with the below content.<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<urlCompression doDynamicCompression="true" doStaticCompression="true" dynamicCompressionBeforeCache="true"/>
<staticContent>
<remove fileExtension=".svg" />
<mimeMap fileExtension=".svg" mimeType="image/svg+xml" />
<mimeMap fileExtension=".woff" mimeType="application/font-woff" />
<clientCache httpExpires="Mon, 30 Mar 2020 00:00:00 GMT" cacheControlMode="UseExpires" />
</staticContent>
<handlers>
<remove name="OPTIONSVerbHandler" />
<remove name="PHP54_via_FastCGI" />
<add name="PHP54_via_FastCGI" path="*.php" verb="GET,HEAD,POST,OPTIONS" modules="FastCgiModule" scriptProcessor="D:Program Files (x86)PHPv5.4php-cgi.exe" resourceType="Either" />
</handlers>
<rewrite>
<rules>
<rule name="Laravel5" 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" />
</conditions>
<action type="Rewrite" url="index.php" appendQueryString="true" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
About Ideas2IT,Are you looking to build a great product or service? Do you foresee technical challenges? If you answered yes to the above questions, then you must talk to us. We are a world-class custom .NET development company. We take up projects that are in our area of expertise. We know what we are good at and more importantly what we are not. We carefully choose projects where we strongly believe that we can add value. And not just in engineering but also in terms of how well we understand the domain. Book a free consultation with us today. Let’s work together.

