当前位置:35分类目录 » 站长资讯 » 站长资讯 » 站长运营 » 文章详细 订阅RssFeed

最新可用的ASP伪静态规则”hpptd.ini“规则

来源:本站原创 浏览:384次 时间:2015-11-25
实现asp伪静态化首先要服务器空间要支持rewrite重写,然后是URL Rewrite中的httpd.ini伪静态化规则编写,伪静态Rewrite规则编写方法是新建一个httpd.ini,里面写上类似如下代码,再将写好的httpd.ini上传到你网站的根目录下,这里列举的是我司制作一个网站所用到的伪静态规则,当然每个人的网站,规则写得当然不一样,但形式是差不多的, 正如我司常用的伪静态规则,如:

shownews.asp?id=xx可写伪静态规则 
RewriteRule /shownews-([0-9,a-z]*).html /shownews.asp\?id=$1

如后面带参数如BigClassName=一个大类&SmallClassName=一个小类,这样的规则可写成RewriteRule /product-(.*?)-(.*?).html /product.asp\?BigClassName=$1&SmallClassName=$2,这规则里面用到的都是写正则表达式,想了解正在表达式可以在网上看下相关的资料。 

[ISAPI_Rewrite] 
# 3600 = 1 hour 
CacheClockRate 3600 
RepeatLimit 32 
# Block external access to the httpd.ini and httpd.parse.errors files 

RewriteRule /shownews-([0-9,a-z]*).html /shownews.asp\?id=$1 

RewriteRule /showproduct-([0-9,a-z]*).html /showproduct.asp\?id=$1 

RewriteRule /noteshow-([0-9,a-z]*).html /noteshow.asp\?id=$1 

RewriteRule /news-(.*?).html /news.asp\?BigClassName=$1 

RewriteRule /about-(.*?).html /about.asp\?BigClassName=$1 

RewriteRule /product-(.*?).html /product.asp\?BigClassName=$1 

RewriteRule /product-(.*?)-(.*?).html /product.asp\?BigClassName=$1&SmallClassName=$2 

RewriteRule /news-(.*?)-(.*?).html /news.asp\?BigClassName=$1 [N,I,L,O]&SmallClassName=$2 [N,I,L,O] 

RewriteRule /product-(.*?)-([0-9,a-z]*).html /product.asp\?BigClassName=$1 [N,I,L,O]&page=$2 

RewriteRule /news-(.*?)-([0-9,a-z]*).html /news.asp\?BigClassName=$1 [N,I,L,O]&page=$2 

RewriteRule /news-(.*?)-(.*?)-([0-9,a-z]*).html /news.asp\?BigClassName=$1&SmallClassName=$2 [N,I,L,O]&page=$3 

RewriteRule /product-(.*?)-(.*?)-([0-9,a-z]*).html /product.asp\?BigClassName=$1&SmallClassName=$2 [N,I,L,O]&page=$3 

RewriteRule /notebook-(.*?)-(.*?)-([0-9,a-z]*).html /notebook.asp\?BigClassName=$1&SmallClassName=$2 [N,I,L,O]&page=$3 

RewriteRule /notebook-([0-9,a-z]*).html /notebook.asp\?page=$1 

RewriteRule /httpd(?:\.ini|\.parse\.errors).* / [F,I,O] 
# Block external access to the Helper ISAPI Extension 
RewriteRule .*\.isrwhlp / [F,I,O] 
RewriteRule /index.html /index.asp $1 
RewriteRule /news.html /news.asp $1 
RewriteRule /notebook.html /notebook.html $1 

RewriteRule .*\.isrwhlp / [F,I,O] RewriteRule /index.html /index.asp $1RewriteRule /news.html /news.asp $1RewriteRule /notebook.html /notebook.html $1

下面还有种写法,我没用过,是网上别人那复制过来的 

httpd.ini 内容写法如下: 

[ISAPI_Rewrite] 
# 3600 = 1 hour 
CacheClockRate 3600 
RepeatLimit 32 
# Block external access to the httpd.ini and httpd.parse.errors files 
RewriteRule /httpd(?:.ini|.parse.errors).* / [F,I,O] 
# Block external access to the Helper ISAPI Extension 
RewriteRule .*.isrwhlp / [F,I,O] 
RewriteRule ^(.*)/index.asp $1/index.html 
RewriteRule ^(.*)/([0-9]*).html $1/article.asp?id=$2 
RewriteRule ^(.*)/([a-z]*)/([a-z]*)/ $1/list.asp?x=$2&y=$3 

该规则具体说明: 


RewriteRule ^(.*)/index.asp $1/index.html 

是将index.asp 伪静态为index.html

RewriteRule ^(.*)/([0-9]*).html $1/article.asp?id=$2 

文章页伪静态,把article.asp?id=xxx映射成 /xxx.html ,其中xxx为文章ID号,在article.asp中接收id, id=request(“id”), 根据ID由数据库中取数据即可;

RewriteRule ^(.*)/([a-z]*)/([a-z]*)/ $1/list.asp?x=$2&y=$3 

文章列表页伪静态, 把/list.asp?x=$2&y=$3 映射成 如:/news/sports/ 格式,$2对应news,$3对应 sports ,在数据库中取news中sports文章显示即可;其中([a-z]*)代表任意字母,([0-9]*)代表数字;


怎么样,这个httpd.ini的ASP伪静态规则还不错吧~