15053971836 注册 / 登录

asp伪静态代码

时间: 阅读:479
asp伪静态代码

最佳回答

建站最低500起

建站最低500起

2023-01-15 12:39:02

1、安装ISAPI_REWRITE:在iis里添加rewrite.dll
2、httpd.ini 文件书写规则
将http://localhost/rewrite.asp?page=1伪造成http://localhost/rewrite_1.html
RewriteRule /rewrite_(d+).html /rewrite.asp?page=$1 [N,I]
将http://localhost/rewrite.asp?page=1&id=1伪造成http://localhost/rewrite_1_1.html
RewriteRule /rewrite_(d+)_(d+).html /rewrite.asp?page=$1&id=$2 [N,I]
将http://localhost/rewrite.asp?page=1#abc伪造成http://localhost/rewrite_1.html#abc
RewriteRule /rewrite_(d+).html#(d+) /rewrite.asp?page=$1#$2 [N,I]
3、asp代码示例
page=cint(request("page"))
id=request("id")
If page="" or page<1 Then page=1
If id="" or id<1 Then id=1
For i=1 to 10
Response.Write "<a href='rewrite_"&i&"_"&id&".html'>"&i&"</a>"
Next

最新回答共有2条回答

  • 游客
    回复
    2023-01-15 14:14:05

    asp伪静态化
    安装说明:1、在IIS的Isapi上添加这个筛选器,筛选器名称 re,可执行文件选择 Rewrite.dll ;2、设置httpd.ini文件RewriteRule /news/(d+).html /jsp/news.jsp?id=$1 [N,I]表示将news.asp?id=95 转换成news/95.html以此类推,如果你有更多的参数,则增加相应的(d+),而后面的id=$1,则增加id=$2,等等。
    目前较为普遍的动态网页包括asp,php,jsp,shtml,jhtml,cgi......甚至还有一些自己定义的,比如:aspx,do,index,hello 等等。表现形式为:news.asp?id=95。建议读者通过re_write将其转换成news/95.html,以便于google对改网页的识别。re_write是iis里的一个模块,当需要将news.asp?id=95的映射成news/95.html时,只需设置httpd.ini文件:RewriteRule /new
    如果你在处理数据翻页,那么写法是:
    More_<%=Page%>_<%=type%>.html (注:page是翻页页数,type是数据类型)
    表现形式:More_1_95.html
    如果翻下一页,则为:More_2_95.html,继续下一页的循环,则是:
    More_3_95.html,以此类推。
    不过你需要在httpd.ini文件中增加以下代码:
    RewriteRule /More_(d+)_(d+).html /jsp/more.jsp?page=$1&type=$2 [N,I]
    如果你的动态程序有多个参数需要传递,那么就增加多个(d+)即可,如下:
    RewriteRule /More_(d+)_(d+)_(d+).html /jsp/more.jsp?page=$1&type=$2&type2=$3 [N,I]
    翻页