Setting Default Document for Laravel in IIS

If you build Laravel applications in Windows 10 using IIS, you will get an error message if you try viewing your web site. This is easily fixed appending web.config.
When you setup a website entry in IIS and point it to your Laravel application, you’ll get the error message below:

A default document needs to be set which isn’t done by the initial Laravel installation. The path to this document is /public/index.php. Add the following code to web.config, and then the site will be served by IIS.

<configuration>
  <system.webServer>
    <defaultDocument enabled="true">
      <files>
        <add value="public/index.php" />
       </files>
    </defaultDocument>
</configuration>

Leave a Comment