windows2003 PHP IIS URL重写去掉index.php

2017-12-20 16:40:00

IIS版本比较低的话要URL重写就要使用到ISAPI_Rewrite,来实现URL重写


安装ISAPI_Rewrite3


httpd.conf 里面配置URL重写完整代码....

 view pl copy

# Helicon ISAPI_Rewrite configuration file  

# Version 3.1.0.104  

  

RewriteEngine On  

RewriteCompatibility2 On  

RepeatLimit 32  

RewriteBase   

# unsupported directive: [ISAPI_Rewrite]  

  

#  3600 = 1 hour  

# unsupported directive: CacheClockRate 3600  

  

  

#  Protect httpd.ini and httpd.parse.errors files  

#  from accessing through HTTP  

# RewriteRule ^/httpd(?:\.ini|\.parse\.errors).* [F,I,O]  

RewriteCond %{REQUEST_FILENAME} !-f  

RewriteCond %{REQUEST_FILENAME} !-d  

RewriteRule (.*)$ /index.php?s=$1 [I]  

 

ISAPI_Rewrite设置OK了


IIS添加筛选器

打开Helicon Manager(安装ISAPI_Rewrite文件目录的文件)

这是就可以看到IIS已经加载我们之前配置的httpd.conf 文件


当前我可以点击Edit进行编辑

要是点击Import from v2.0的话:显示如下

这里也是ISAPI_Rewrite安装后的目录里面的配置文件...可能有些童鞋网上下载可能没这个文件....不过不要紧...直接在httpd.conf文件里编辑就行了

要是存在httpd.ini文件的时候这里打开后会备份之钱的httpd.conf配置文件根据httpd.ini的配置生成新的httpd.conf配置文件