首先你必须安装好环境,然后你必须去网上Download一个IIS _Rewrite,你可以Google一把,肯定能下载下来的,里面的东西是httpd.ini文件(配置好后要在这个文件里面加入重写规则),httpd.parse.errors文件(不用管它),mtbnotif.dll文件(不用管它,too),Rewrite.dll(最重要的就是他了,配置的时候要用到它)
打开iis,然后选择你的站点,右键属性
选择isapi筛选器,点击添加
名称里面填写ReWrite,或者自己起个名字,点击浏览选择Rewrite.dll文件(当然前提是你已经把你下载到的IIS _Rewrite文件夹放在了你的站点下,放在根目录即可),点击确定就行。Rewrite就开始工作了,但是伪静态成什么样子呢,当然要你自己写规则,可以用记事本打开httpd.ini文件,
View Code
1
view plaincopy to clipboardprint
?
2 01 .[ISAPI_Rewrite]
3 02 .
4 03 .# 3600 = 1 hour
5 04 .CacheClockRate 3600
6 05 .
7 06 .RepeatLimit 32
8 07 .
9 08 .# Protect httpd.ini and httpd.parse.errors files
10 09 .# from accessing through HTTP
11 10 .
12 11 .RewriteRule / FredBack\.html\ ?* (. * )$ / FredBack\.aspx\
13 12 .
14 13 .RewriteRule / LineDetail_([ 0 - 9 ] + )\.html\ ?* (. * )$ / LineDetail\.aspx\ ? Id = $ 1
15 14 .RewriteRule / NewsDetail_([ 0 - 9 ] + )\.html\ ?* (. * )$ / NewsDetail\.aspx\ ? Id = $ 1
16 15 .RewriteRule .. / LineDetail_([ 0 - 9 ] + )\.html\ ?* (. * )$ .. / LineDetail\.aspx\ ? Id = $ 1
17 16 .RewriteRule .. / NewsDetail_([ 0 - 9 ] + )\.html\ ?* (. * )$ .. / NewsDetail\.aspx\ ? Id = $ 1
18 17 .
19 18 .RewriteRule / About_jianjie\.html\ ?* (. * )$ / About\.aspx\ ? title = jianjie
20 19 .RewriteRule / About_zhaopin\.html\ ?* (. * )$ / About\.aspx\ ? title = zhaopin
21 20 .RewriteRule / About_lianxi\.html\ ?* (. * )$ / About\.aspx\ ? title = lianxi
22 21 .RewriteRule / Result_(. * )\.html\ ?* (. * )$ / Result\.aspx\ ? name = $ 1
23 22 .RewriteRule / YuDing_(. * )\.html\ ?* (. * )$ / YuDing\.aspx\ ? Id = $ 1
24 23 .
25 24 .RewriteRule / FredBack\.html\ ?* (. * )$ / FredBack\.aspx
26 25 .RewriteRule / NewsList\.html\ ?* (. * )$ / NewsList\.aspx
27 26 .RewriteRule / LineList\.html\ ?* (. * )$ / LineList\.aspx
28 27 .RewriteRule / FredBack_([ 0 - 9 ] + )\.html\ ?* (. * )$ / FredBack\.aspx\ ? page = $ 1
29 28 .RewriteRule / NewsList_t([ 0 - 9 ] + )\.html\ ?* (. * )$ / NewsList\.aspx\ ? type = $ 1
30 29 .RewriteRule / LineList_t([ 0 - 9 ] + )\.html\ ?* (. * )$ / LineList\.aspx\ ? type = $ 1
31 30 .
32 31 .RewriteRule / NewsList_t([ 0 - 9 ] + )_p([ 0 - 9 ] + )\.html\ ?* (. * )$ / NewsList\.aspx\ ? type = $ 1 & page = $ 2
33 32 .RewriteRule / LineList_t([ 0 - 9 ] + )_p([ 0 - 9 ] + )\.html\ ?* (. * )$ / LineList\.aspx\ ? type = $ 1 & page = $ 2
34 33 .RewriteRule / admin / Default\.html\ ?* (. * )$ / admin / Default\.aspx
2 01 .[ISAPI_Rewrite]
3 02 .
4 03 .# 3600 = 1 hour
5 04 .CacheClockRate 3600
6 05 .
7 06 .RepeatLimit 32
8 07 .
9 08 .# Protect httpd.ini and httpd.parse.errors files
10 09 .# from accessing through HTTP
11 10 .
12 11 .RewriteRule / FredBack\.html\ ?* (. * )$ / FredBack\.aspx\
13 12 .
14 13 .RewriteRule / LineDetail_([ 0 - 9 ] + )\.html\ ?* (. * )$ / LineDetail\.aspx\ ? Id = $ 1
15 14 .RewriteRule / NewsDetail_([ 0 - 9 ] + )\.html\ ?* (. * )$ / NewsDetail\.aspx\ ? Id = $ 1
16 15 .RewriteRule .. / LineDetail_([ 0 - 9 ] + )\.html\ ?* (. * )$ .. / LineDetail\.aspx\ ? Id = $ 1
17 16 .RewriteRule .. / NewsDetail_([ 0 - 9 ] + )\.html\ ?* (. * )$ .. / NewsDetail\.aspx\ ? Id = $ 1
18 17 .
19 18 .RewriteRule / About_jianjie\.html\ ?* (. * )$ / About\.aspx\ ? title = jianjie
20 19 .RewriteRule / About_zhaopin\.html\ ?* (. * )$ / About\.aspx\ ? title = zhaopin
21 20 .RewriteRule / About_lianxi\.html\ ?* (. * )$ / About\.aspx\ ? title = lianxi
22 21 .RewriteRule / Result_(. * )\.html\ ?* (. * )$ / Result\.aspx\ ? name = $ 1
23 22 .RewriteRule / YuDing_(. * )\.html\ ?* (. * )$ / YuDing\.aspx\ ? Id = $ 1
24 23 .
25 24 .RewriteRule / FredBack\.html\ ?* (. * )$ / FredBack\.aspx
26 25 .RewriteRule / NewsList\.html\ ?* (. * )$ / NewsList\.aspx
27 26 .RewriteRule / LineList\.html\ ?* (. * )$ / LineList\.aspx
28 27 .RewriteRule / FredBack_([ 0 - 9 ] + )\.html\ ?* (. * )$ / FredBack\.aspx\ ? page = $ 1
29 28 .RewriteRule / NewsList_t([ 0 - 9 ] + )\.html\ ?* (. * )$ / NewsList\.aspx\ ? type = $ 1
30 29 .RewriteRule / LineList_t([ 0 - 9 ] + )\.html\ ?* (. * )$ / LineList\.aspx\ ? type = $ 1
31 30 .
32 31 .RewriteRule / NewsList_t([ 0 - 9 ] + )_p([ 0 - 9 ] + )\.html\ ?* (. * )$ / NewsList\.aspx\ ? type = $ 1 & page = $ 2
33 32 .RewriteRule / LineList_t([ 0 - 9 ] + )_p([ 0 - 9 ] + )\.html\ ?* (. * )$ / LineList\.aspx\ ? type = $ 1 & page = $ 2
34 33 .RewriteRule / admin / Default\.html\ ?* (. * )$ / admin / Default\.aspx
规则写完后,你程序中的连接都必须改成静态的,看,改完后程序里面就没有类似于?参数名=参数值的url出现了,如果你用虚拟主机的话,记得让服务商帮你设置好iis伪静态啊