Rewrite URLs in Laravel on Windows with IIS

Submitted by ggwebdev - 5 years ago

The URL rewriting in Windows IIS is via a configuration xml file located in the site root with the name of web.config. The code below abilita and does the same paper apache .htaccess, just copy the code below and paste it in your web.config file by saving it in the folder public / project, assuming you've directed your root directory to public /, everything should work fine!

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <rule name="Imported Rule 1" stopProcessing="true">
                    <match url="^" ignoreCase="false" />
                    <conditions logicalGrouping="MatchAll">
                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
                    </conditions>
                    <action type="Rewrite" url="index.php" />
                </rule>
            </rules>
        </rewrite>
    </system.webServer>
</configuration>