Update web.config

This commit is contained in:
printempw 2018-07-25 17:59:08 +08:00
parent a237037ade
commit 0c1537446f

View File

@ -1,6 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<defaultDocument>
<files>
<clear />
<add value="index.php" />
<add value="index.html" />
</files>
</defaultDocument>
<!-- Fix webfont issue on IIS -->
<staticContent>
<mimeMap fileExtension="." mimeType="image/png" />
<remove fileExtension=".woff"/>
@ -8,27 +15,33 @@
<remove fileExtension=".woff2"/>
<mimeMap fileExtension=".woff2" mimeType="application/x-font-woff2" />
</staticContent>
<!-- For rewrite to work install URL Rewrite Module via Web Platform Installer -->
<!-- For rewrite to work please install IIS URL Rewrite Module -->
<rewrite>
<rules>
<rule name="bss" patternSyntax="Wildcard">
<match url="*" />
<rule name="Block access to dotfiles">
<match url="(^\.|/\.)" ignoreCase="false" />
<action type="CustomResponse" statusCode="403" statusReason="Forbidden" />
</rule>
<rule name="Block access to storage path">
<match url="^storage/.*" ignoreCase="false" />
<action type="CustomResponse" statusCode="403" statusReason="Forbidden" />
</rule>
<rule name="Redirect trailing slashes if not a folder" stopProcessing="true">
<match url="^(.*)/$" ignoreCase="false" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
</conditions>
<action type="Redirect" redirectType="Permanent" url="/{R:1}" />
</rule>
<rule name="Handle front controller" stopProcessing="true">
<match url="^" ignoreCase="false" />
<conditions>
<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>
<!-- Protect .env file -->
<location path="~/.env">
<system.web>
<authorization>
<deny users="*"/>
</authorization>
</system.web>
</location>
</configuration>