Skip to content

Instantly share code, notes, and snippets.

@thinhhung
Last active September 6, 2016 06:34
Show Gist options
  • Save thinhhung/9f71b2554aa4e341f622dfc8de3f170d to your computer and use it in GitHub Desktop.
Save thinhhung/9f71b2554aa4e341f622dfc8de3f170d to your computer and use it in GitHub Desktop.

Laravel 5 in Windows Server IIS

###1. Put this web.config in laravel root diretory

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.webServer>
        <defaultDocument>
            <files>
                <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" />
            </files>
        </defaultDocument>
        <rewrite>
            <rules>
                <rule name="Imported Rule 1">
                    <match url="^(.*)$" ignoreCase="false" />
                    <action type="Rewrite" url="/public/{R:1}" />
                </rule>
                <rule name="Imported Rule 2" stopProcessing="true">
                    <match url="^(.*)$" />
                    <conditions logicalGrouping="MatchAll">
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />                     
                    </conditions>
                    <action type="Rewrite" url="public/index.php/{R:1}" />
                </rule>
            </rules>
        </rewrite>
    </system.webServer>
</configuration>

###2. Done. Don't move the public folder or any file :)

###3. Convert .htaccess to web.config http://cbsa.com.br/tools/online-convert-htaccess-to-web-config.aspx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment