Maison > Article > développement back-end > IIS安装Apache伪静态插件,iisapache伪静态_PHP教程
Apache和IIS分别有自己的伪静态操作方法,那在Servers2003_IIS需要给PHP程序使用伪静态呢?安装rewrite插件包。
一、下载rewrite插件包,一般里面必须有httpd.ini和Rewrite.dll,如图:
二、一般推荐将伪静态包放至网站根目录下,然后在需要伪静态的网站右击选择属性,如图:,找到ISAPI筛选器,添加rewrite.dll,关闭IIS后再打开,发生优先级变成高,如图:,说明安装成功了。
三、打开httpd.ini,开始配置伪静态
<span> 1</span> <span>[ISAPI_Rewrite] </span><span> 2</span> <span> 3</span> <span>#</span><span> 3600 = 1 hour</span> <span> 4</span> CacheClockRate 3600 <span> 5</span> <span> 6</span> RepeatLimit 32 <span> 7</span> <span> 8</span> <span> 9</span> <span>#</span><span> Protect httpd.ini and httpd.parse.errors files</span> <span>10</span> <span>#</span><span> from accessing through HTTP</span> <span>11</span> <span>12</span> <span>#</span><span> =====以上是默认代码建议不改,#为注释=====</span>
<span> 1</span> <span>#</span><span>RewriteRule --伪静态编辑</span> <span> 2</span> <span>#</span><span>^/ 前置为域名</span> <span> 3</span> <span>#</span><span>/$ 此处为止</span> <span> 4</span> <span>#</span><span>/ --被伪静态-- \ --后缀-- \</span> <span> 5</span> RewriteRule ^/webiste/$ /webiste/index\.<span>php\ </span><span> 6</span> <span> 7</span> <span>#</span><span>([a-z]+) --正则表达式</span> <span> 8</span> <span>#</span><span>一个()代表一个$数字</span> <span> 9</span> <span>#</span><span>(/?) --表示/可有可无</span> <span>10</span> RewriteRule ^/webiste/([a-z]+)(/?)$ /webiste/$1\
四、伪静态是实时更新的,所以可以做即时测试。
PS:([a-z0-9]+),(/page?)([a-z0-9]+)(/?)