lidonghe 发表于 2017-12-28 17:34:58

WIN7 下IIS7的rewrite伪静态功能设置方法

  win7系统都自带有iis的功能。关于WIN7下IIS的安装,请参考这里 http://jingyan.baidu.com/article/219f4bf723bcb2de442d38ed.html
  首先要下载rewrite 的64位的组件 rewrite_x64_zh-CN.msi。官方的下地址是:http://www.microsoft.com/zh-cn/download/details.aspx?id=7435
  选择简体中文版的就行。

  安装之后,再配置web.config 增加 rewrite规则就可以实现伪静态的功能了。
  

<system.webServer>  
<rewrite>
  
<rules>
  
<rule name="Test" patternSyntax="Wildcard">
  
<match url="WeChat/dist/*" />
  
<conditions>
  
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
  
</conditions>
  
<action type="Rewrite" url="/WeChat/dist/index.aspx" />
  
</rule>
  
</rules>
  
</rewrite>
  
</system.webServer>
  

  用到这个方法主要是因为在部署ReactJs单页面应用项目到微信公众号时首页是index.aspx,公众号自定义菜单链接时访问的路由地址如:http://www.ex.com/WeChat/dist/member时会报错,所以才需要对IIS做以上的配置才能正常访问。
页: [1]
查看完整版本: WIN7 下IIS7的rewrite伪静态功能设置方法