适用于Typecho开启伪静态的Gearhost IIS配置文件
简要说明
GearHost主机空间使用的是windows server的IIS为我们提供服务,控制面板中能够设置的东西有限,如果需要设置自定义错误页面或者添加伪静态等都需要自己配置web.config。
Github:XieYuQAQ/GearHost_web_config
设置内容
- 添加MIME类型:.webp .json
- 设定自定义404页面
- 设置地址重写
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
| <?xml version="1.0"?> <configuration> <system.web> <compilation debug="true" targetFramework="4.0"/> </system.web> <system.webServer> <!--设置自定义404页面--> <httpErrors errorMode="Custom"> <remove statusCode="404" /> <error statusCode="404" path="/ErrorPage/404.html" responseMode="ExecuteURL" /> </httpErrors> <staticContent> <mimeMap fileExtension=".json" mimeType="application/json" /> <mimeMap fileExtension=".webp" mimeType="image/webp" /> </staticContent> <!--地址重写代码--> <rewrite> <rules> <rule name="typecho" 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/{R:1}"/> </rule> </rules> </rewrite> </system.webServer> </configuration>
|