一个朋友让我想办法在他的windows服务器上修改代码。他在运行IIS6,而我能找到的唯一东西就是Isapi。我对它并不熟悉,也读过一些文档,但我不能完全理解它。他想重写这些URLS,使它们变得干净
Www.domain.com/cat.php?CTGID=#
和
www.domain.com/pp.php?ID=##
我如何着手重写这两个URLS,使它们在ISAPI中变得干净。我已经在Windows Server上安装了它,我是将这些规则放在他网站文件夹的IISF.ini中,还是将这些代码放在主IISF文件中?任何帮助都将不胜感激!
发布于 2012-07-18 08:41:50
重写规则位于web.config文件或ApplicationHost.config中。如http://learn.iis.net/page.aspx/465/url-rewrite-module-configuration-reference/中所述
示例
<rewrite>
<rules>
<rule name="Force WWW" stopProcessing="true">
<match url=".*" />
<conditions>
<add input="{HTTP_HOST}" pattern="^example.com$" />
</conditions>
<action type="Redirect" url="http://www.example.com/{R:0}" redirectType="Permanent" />
</rule>
<rule name="Redirect from blog">
<match url="^blog/([_0-9a-z-]+)/([0-9]+)" />
<action type="Redirect" url="article/{R:2}/{R:1}" redirectType="Found" />
</rule>
<rule name="Rewrite to article.aspx">
<match url="^article/([0-9]+)/([_0-9a-z-]+)" />
<action type="Rewrite" url="article.aspx?id={R:1}&title={R:2}" />
</rule>
</rules>
</rewrite>发布于 2013-04-17 00:58:54
对于IIS,如果安装了ISAPI_Rewrite模块,则设置$_SERVER"IIS_UrlRewriteModule“并包含该模块的版本号。因此您可以检查此服务器变量是否存在。
https://stackoverflow.com/questions/11268508
复制相似问题