您好,欢迎来到

中国信息港

! 请登录 免费注册
  • 在线企业QQ:

windows2008 iis7伪静态

服务器
2013-4-22   阅读:94

windows2008 iis7伪静态最近客户问题的比较多,我就为我们的dns30服务器写个简略的说明吧!

主机环境:windows 2008 +iis7 +自带的URLRewriter组件

在网站的根目录web.config中配置:net的伪静配置名为rule1,php的伪静态我们配置为rule2,asp的伪静态我们配置为rule3;详情如下:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="rule1" stopProcessing="true">
<match url="^article/([0-9]+)/([_0-9a-z-]+)" />
<action type="Rewrite" url="article.aspx?id={R:1}&amp;title={R:2}" />
</rule>
<rule name="rule2" stopProcessing="true">
<match url="^tags/([0-9]+)" />
<action type="Rewrite" url="tags.php?tags={R:1}" />
</rule>
<rule name="rule3" stopProcessing="true">
<match url="^test.html" />
<action type="Rewrite" url="test.asp" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>

测试页:

1、aspx

<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>aspx urlRewrite Test</title>
</head>
<body>
<h1>URL Rewrite Module Test Page</h1>
<table>
<tr>
<th>Server Variable</th>
<th>Value</th>
</tr>
<tr>
<td>Original URL: </td>
<td><%= Request.ServerVariables["HTTP_X_ORIGINAL_URL"] %></td>
</tr>
<tr>
<td>Final URL: </td>
<td><%= Request.ServerVariables["SCRIPT_NAME"] + "?" + Request.ServerVariables["QUERY_STRING"] %></td>
</tr>
</table>
</body>
</html>

windows2008 iis7伪静态如果有疑问请联系我们:QQ523994515

转载保持链接:http://www.cncnc.com.cn/news/shownews-619-1.html