凹丫丫网络社区's Archiver

oyaya 发表于 2008-1-10 20:56

不用 url rewrite 实现asp伪静态 方便没有主机的兄弟们

<P>实践证明,伪静态比动态页面能够让搜索引蜘蛛擎更好的收录你的网站,<BR>所以很多站长都采用伪静态来优化网站,但是需要服务器安装 isapi rewrite 或者 mod rewrite<BR>对于许多使用虚拟主机的站长,由于服务器不支持 url rewrite, 伪静态很难实现。<BR>所以我自己写了一段代码,把这段代码插入你需要伪静态的页面,就可以实现了<BR>1.单参数<BR>功能:<BR>把:<A href="http://www.oyaya.net/index.asp?id=123" target=_blank><A href="http://www.oyaya.net/index.asp?id=123" target=_blank><FONT color=#0000ff>www.oyaya.net/index.asp?id=123</FONT></A></A><BR>伪静态为:<A href="http://www.oyaya.net/index.asp?/123.html" target=_blank><A href="http://www.oyaya.net/index.asp?/123.html" target=_blank><FONT color=#0000ff>www.oyaya.net/index.asp?/123.html</FONT></A></A><BR>代码: <BR>-------------------------------<BR>&lt;%<BR>id=request.QueryString("id")&nbsp;&nbsp;<BR>If id="" Then&nbsp; &nbsp;&nbsp;&nbsp;<BR>serversc=Request.ServerVariables("QUERY_STRING")&nbsp; &nbsp; <BR>id=replace(serversc,"/","")<BR>id=replace(id,".html","")<BR>End If&nbsp; &nbsp;&nbsp;&nbsp;<BR>%&gt;<BR>-------------------------------<BR><BR>2.多参数<BR>功能:<BR>把:<A href="http://www.oyaya.net/index.asp?id=123&amp;page=1&amp;order=2" target=_blank><A href="http://www.oyaya.net/index.asp?id=123&amp;page=1&amp;order=2" target=_blank><FONT color=#0000ff>www.oyaya.net/index.asp?id=123&amp;page=1&amp;order=2</FONT></A></A><BR>伪静态为:<A href="http://www.oyaya.net/index.asp?/123-1-2.html" target=_blank><A href="http://www.oyaya.net/index.asp?/123-1-2.html" target=_blank><FONT color=#0000ff>www.oyaya.net/index.asp?/123-1-2.html</FONT></A></A><BR><BR>代码: <BR>-------------------------------<BR>&lt;%<BR>If id="" and page="" and order="" Then&nbsp; &nbsp;&nbsp;&nbsp;<BR>serversc=Request.ServerVariables("QUERY_STRING")&nbsp; &nbsp; <BR>id=replace(serversc,"/","")<BR>id=replace(id,".html","")<BR>arr=split(id,"-")<BR>id=arr(0)<BR>page=arr(1)<BR>order(2)<BR>End If <BR>%&gt;<BR>-------------------------------<BR><BR><BR>使用方法: 把代码加到需要传递参数的asp页的 类似于<BR>"id=request.QueryString("id") " 代码后面就可以了<BR>请把 id, page, order 修改你所需要的参数即可。 </P>

独闯天下 发表于 2008-1-12 13:55

不用 url rewrite 实现asp伪静态 方便没有主机的兄弟们

没有自己的服务器就只能用这个了

bmy008008 发表于 2008-1-12 21:16

不用 url rewrite 实现asp伪静态 方便没有主机的兄弟们

太好了

TroyHorse 发表于 2008-4-13 13:53

学习了,楼主辛苦了!!!

页: [1]

Powered by Discuz! Archiver 6.1.0  © 2001-2007 Comsenz Inc.