惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

大猫的无限游戏
大猫的无限游戏
H
Help Net Security
The Cloudflare Blog
Y
Y Combinator Blog
A
Arctic Wolf
Cyberwarzone
Cyberwarzone
G
Google Developers Blog
Recent Announcements
Recent Announcements
S
SegmentFault 最新的问题
Microsoft Security Blog
Microsoft Security Blog
WordPress大学
WordPress大学
博客园 - Franky
罗磊的独立博客
Martin Fowler
Martin Fowler
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
博客园 - 三生石上(FineUI控件)
N
News and Events Feed by Topic
F
Fortinet All Blogs
N
News | PayPal Newsroom
J
Java Code Geeks
www.infosecurity-magazine.com
www.infosecurity-magazine.com
博客园 - 【当耐特】
M
MIT News - Artificial intelligence
Google Online Security Blog
Google Online Security Blog
Recorded Future
Recorded Future
博客园 - 聂微东
S
Securelist
C
CERT Recently Published Vulnerability Notes
小众软件
小众软件
Cisco Talos Blog
Cisco Talos Blog
S
Security Affairs
NISL@THU
NISL@THU
A
About on SuperTechFans
PCI Perspectives
PCI Perspectives
N
News and Events Feed by Topic
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Jina AI
Jina AI
Microsoft Azure Blog
Microsoft Azure Blog
AWS News Blog
AWS News Blog
GbyAI
GbyAI
C
Cyber Attacks, Cyber Crime and Cyber Security
V
Vulnerabilities – Threatpost
D
Docker
P
Proofpoint News Feed
W
WeLiveSecurity
Help Net Security
Help Net Security
The GitHub Blog
The GitHub Blog
The Last Watchdog
The Last Watchdog
The Hacker News
The Hacker News
博客园 - 叶小钗

博客园 - Ray Lynn

使用 flex air 读写文件 - Ray Lynn Google Chrome 源码下载 什么是SAAS? QQ盗号木马原理 WindowsSockets 错误码 js操作cookies类 使用 Microsoft SOAP Toolkit 2.0 建立安全 Web 服务 历史上最强的代码 饭否,唧歪们MSN、QQ、GTalk机器人实现原理及代码 这是比月读还强的幻术!! - Ray Lynn - 博客园 .net 中的伪静态方式. 来自 Discuz!NT ACCESS 创建表及索引方式 VB6 判断网络是否正常类 眼保健操 面向服务的面向业务基础 VB6编程中如何获取硬盘分区信息 原味香菇片蒸鸡腿 定制特性学习笔记 [转]C#中的定制特性(Attributes)
伪静态网页的实现
Ray Lynn · 2007-08-09 · via 博客园 - Ray Lynn

众所周知,伪静态网页有易被搜索引擎捕捉的特点,但也有致命的高CPU负荷弊端。它不同与普通html页面,在同样的状况下,比html稍慢,可以说,他的出现完全是为了满足搜索的需要。

下面通过两个例子简要说一下,asp如何实现伪静态页面:

一、伪静态内容页

1、设想的效果:用test.asp显示N条新闻记录,每条记录的链接是xxx.html形式的,而非.asp?id=xxx形式。点击某一链接,打开新页面,地址栏显示:http://localhost/news/xxx.html,并在该页读取数据库信息,显示该条新闻内容。

2、实现步骤:

1)本站下载re_write模

文件: rewrite.rar
大小: 87KB
下载: 下载

块(实际上是2个dll文件、1个ini文件和1个errors文件),并解压缩

2)在IIS的ISAPI上添加一个筛选器,命名为rewrite,可执行文件选择刚才下载的 Rewrite.dll文件;
3)打开httpd.ini文件,并设置:
RewriteRule /news/(\d+)\.html /news\.asp\?id=$1 [N,I]
表示将news.asp?id=23 转换成news/23.html,(\d+)代表id

4)新建test.asp文件于根目录,用于显示新闻记录

<body>

<!--include file="conn.asp"-->
<%
set rs1=server.CreateObject("adodb.recordset")
sql1="select * from ommuban"
rs1.open sql1,conn,1,1
do while not rs1.eof
%>
<div>
 id:<% response.Write "<a href=news/"+rs1("id")+".html target='_blank'>"+rs1("id")+"</a>" %>
</div>
<%
rs1.movenext
loop
rs1.close
%>
</body>

解释:注意加粗的代码,它对应我们修改的ini文件:RewriteRule /news/(\d+)\.html /news\.asp\?id=$1 [N,I]

5)新建news.asp文件于根目录,用于接收test.asp文件传递过来的id参数:rs1("id"),其实实际上浏览的时候并不显示news.asp页面,而是伪造了一个形如/news/3708.html的页面。

代码如下:

<body>

<!--include file="conn.asp"-->
<%
id=request.QueryString("id")   '接收id参数的值

set rs1=server.CreateObject("adodb.recordset")
sql1="select * from ommuban where id='"&id&"'"
rs1.open sql1,conn,1,1
%>
<div>标  题:<%=rs1("title")%></div>
<div>图片地址:<%=rs1("picurl")%></div>
<div>新闻类型:<%=rs1("newstype")%></div>
</body>

6)运行

输入http://localhost/test.asp显示:

点击2118,打开新页面,地址栏如下:

内容显示如下:

标  题:国际新闻#2118

图片地址:..\muban\OM\2118\jpeg\2118.jpg

新闻类型:国际新闻

7)总结

安装处理模块→在IIS中添加ISAPI筛选器(选定Rewrite.dll文件)→为httpd.ini配置筛选规则→在网页链接处应用筛选规则

伪静态网页是为了提高带有Querystring参数传递(即?号后面的参数)的网页被搜索引擎命中的几率。由于他的高cpu占有率弊端,所以最好不要大量使用该方法,而FSO静态页生成技术的大量应用又导致大量的磁盘碎片和比较严重的磁盘负载,两种方法结合使用,FSO静态页面用于解决各栏目页面的动态生成,伪静态页用于解决内容页的动态生成。

分页传递参数的页面筛选规则:News_5_12.html

RewriteRule /News_(\d+)_(\d+)\.html /jsp/more\.asp\?page=$1&type=$2 [N,I]