54SA.COM|专注于系统亚博体育官方网址管理,为中国SA提供动力!

IIS 7配置启用URL Rewrite重写

时间:2012-06-15 13:58来源:未知 编辑:admin

?Windows7或者Windows2008环境下配置IIS 7支持URL Rewrite重写

默认情况下IIS 7没有支持URL Rewrite,要使用URL重写,首先要安装URL Rewrite组建,官方地址如下:

http://www.iis.net/download/URLRewrite?

WEB平台自动安装,安装完成后在网站根目录简历web.config就可以实现URL重写了,下面是一个codeigniter的重写规则:

  1. xml?version="1.0"?encoding="UTF-8"?>?
  2. <configuration>?
  3. ????<system.webServer>?
  4. ????????<rewrite>?
  5. ????????????<rules>?
  6. ????????????????<rule?name="Rewrite?to?index.php">?
  7. ????????????????????<match?url="index.php|robots.txt|images|test.php"?/>?
  8. ????????????????????<action?type="None"?/>?
  9. ????????????????rule>?
  10. ????????????????<rule?name="Rewrite?CI?Index">?
  11. ????????????????????<match?url=".*"?/>?
  12. ????????????????????<conditions>?
  13. ????????????????????????<add?input="{REQUEST_FILENAME}"?pattern="css|js|jpg|jpeg|png|gif|ico|htm|html"?negate="true"?/>?
  14. ????????????????????conditions>?
  15. ????????????????????<action?type="Rewrite"?url="index.php/{R:0}"?/>?
  16. ????????????????rule>?
  17. ????????????rules>?
  18. ????????rewrite>?
  19. ????system.webServer>?
  20. configuration>??

?

[责任编辑:admin]

------分隔线----------------------------