不用 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><%<BR>id=request.QueryString("id") <BR>If id="" Then <BR>serversc=Request.ServerVariables("QUERY_STRING") <BR>id=replace(serversc,"/","")<BR>id=replace(id,".html","")<BR>End If <BR>%><BR>-------------------------------<BR><BR>2.多参数<BR>功能:<BR>把:<A href="http://www.oyaya.net/index.asp?id=123&page=1&order=2" target=_blank><A href="http://www.oyaya.net/index.asp?id=123&page=1&order=2" target=_blank><FONT color=#0000ff>www.oyaya.net/index.asp?id=123&page=1&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><%<BR>If id="" and page="" and order="" Then <BR>serversc=Request.ServerVariables("QUERY_STRING") <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>%><BR>-------------------------------<BR><BR><BR>使用方法: 把代码加到需要传递参数的asp页的 类似于<BR>"id=request.QueryString("id") " 代码后面就可以了<BR>请把 id, page, order 修改你所需要的参数即可。 </P>不用 url rewrite 实现asp伪静态 方便没有主机的兄弟们
没有自己的服务器就只能用这个了不用 url rewrite 实现asp伪静态 方便没有主机的兄弟们
太好了 学习了,楼主辛苦了!!!页:
[1]