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

推荐订阅源

酷 壳 – CoolShell
酷 壳 – CoolShell
H
Hacker News: Front Page
P
Palo Alto Networks Blog
T
ThreatConnect
Apple Machine Learning Research
Apple Machine Learning Research
博客园_首页
T
True Tiger Recordings
P
Privacy & Cybersecurity Law Blog
B
Blog
IT之家
IT之家
Last Week in AI
Last Week in AI
F
Full Disclosure
Hacker News: Ask HN
Hacker News: Ask HN
C
Comments on: Blog
Microsoft Azure Blog
Microsoft Azure Blog
C
Cybersecurity and Infrastructure Security Agency CISA
Microsoft Security Blog
Microsoft Security Blog
博客园 - 【当耐特】
N
News and Events Feed by Topic
NISL@THU
NISL@THU
腾讯CDC
雷峰网
雷峰网
Security Latest
Security Latest
李成银的技术随笔
M
Microsoft Research Blog - Microsoft Research
L
LangChain Blog
L
Lohrmann on Cybersecurity
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
C
Check Point Blog
Y
Y Combinator Blog
Recent Announcements
Recent Announcements
博客园 - Franky
N
News | PayPal Newsroom
V
V2EX
A
About on SuperTechFans
The Register - Security
The Register - Security
月光博客
月光博客
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Google Online Security Blog
Google Online Security Blog
MyScale Blog
MyScale Blog
Cisco Talos Blog
Cisco Talos Blog
Vercel News
Vercel News
WordPress大学
WordPress大学
C
Cyber Attacks, Cyber Crime and Cyber Security
The Hacker News
The Hacker News
IntelliJ IDEA : IntelliJ IDEA – the Leading IDE for Professional Development in Java and Kotlin | The JetBrains Blog
IntelliJ IDEA : IntelliJ IDEA – the Leading IDE for Professional Development in Java and Kotlin | The JetBrains Blog
爱范儿
爱范儿
A
Arctic Wolf
L
LINUX DO - 最新话题
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More

博客园 - Ray Lynn

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