设为首页收藏本站

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 246|回复: 0

Enable mod_rewrite on IIS server

[复制链接]
发表于 2014-4-7 07:51:10 | 显示全部楼层 |阅读模式
Install the Microsoft URL Rewrite module and then create a web.config file in the root of the site with this in it (the rules):
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <configuration>
  3.   <system.webServer>
  4.     <rewrite>
  5.       <rules>
  6.         <rule name="Security Rule" stopProcessing="true">
  7.           <match url="^(.*)$" ignoreCase="false" />
  8.           <conditions logicalGrouping="MatchAny">
  9.             <add input="{QUERY_STRING}" pattern="mosConfig_[a-zA-Z_]{1,21}(=|\%3D)" ignoreCase="false" />
  10.             <add input="{QUERY_STRING}" pattern="base64_encode.*\(.*\)" ignoreCase="false" />
  11.             <add input="{QUERY_STRING}" pattern="(\<|%3C).*script.*(\>|%3E)" />
  12.             <add input="{QUERY_STRING}" pattern="GLOBALS(=|\[|\%[0-9A-Z]{0,2})" ignoreCase="false" />
  13.             <add input="{QUERY_STRING}" pattern="_REQUEST(=|\[|\%[0-9A-Z]{0,2})" ignoreCase="false" />
  14.           </conditions>
  15.           <action type="CustomResponse" url="index.php" statusCode="403" statusReason="Forbidden" statusDescription="Forbidden" />
  16.         </rule>
  17.         <rule name="SEO Rule">
  18.           <match url="(.*)" ignoreCase="false" />
  19.           <conditions logicalGrouping="MatchAll">
  20.             <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" pattern="" ignoreCase="false" />
  21.             <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" pattern="" ignoreCase="false" />
  22.             <add input="{URL}" negate="true" pattern="^/index.php" ignoreCase="false" />
  23.             <add input="{URL}" pattern="(/|\.php|\.html|\.htm|\.feed|\.pdf|\.raw|/[^.]*)$" />
  24.           </conditions>
  25.           <action type="Rewrite" url="index.php" />
  26.         </rule>
  27.       </rules>
  28.     </rewrite>
  29. </system.webServer>
  30. </configuration>
复制代码



您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|小黑屋|BC Morning Website ( Best Deal Inc. 001 )  

GMT-8, 2025-8-25 10:42 , Processed in 0.017996 second(s), 21 queries .

Supported by Best Deal Online X3.5

© 2001-2025 Discuz! Team.

快速回复 返回顶部 返回列表