iis伪静态配置文件
最佳回答
<system.webServer>
<rewrite>
<rules>
<rule name="rD">
<match url="Index.html" />
<action type="Rewrite" url="Index.aspx" />
</rule>
</rule>
</rewrite>
</system.webServer>
这样单页的伪静态就配置好了。然后在页面调用地址。就应该链接index.html不在是index.aspx
这种单页的配置比较简单,相信大家也都会。下面就是来带参数的配置
在configuration节点下
<system.webServer>
<rewrite>
<rules>
<rule name="rPL">
<match url="^list-([0-9]*).html" />
<action type="Rewrite" url="list.aspx?id={R:1}" />
</rule>
</rule>
</rewrite>
</system.webServer>
这样带参数的也就配置好了。
在页面上绑定的时候,就要换一种绑定方法了
<a href='list-<%#Eval("Id")%>.html'><%#Eval("Title")%></a>
绑定的时候就要链接的是html啦,参数直接跟上。跟web.config配置格式一样就行了
如果有多个参数 <action type="Rewrite" url="list.aspx?id={R:1}&cid={R:1}" />如果三个或者四个就继续加&跟上就行
到此为止就完了。
最新回答共有2条回答
-
夜半唱歌
回复iis7.5配置web.config伪静态方法如下:
第一种方法:web.config
代码如下:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="OrgPage" stopProcessing="true">
<match url="^(.*)$" />
<conditions logicalGrouping="MatchAll">
<add input="{HTTP_HOST}" pattern="^(.*)$" />
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="index.php/{R:1}" /><