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,这规则里面用到的都是写正则表达式,想了解正在表达式可以在网上看下相关的资料。
# 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
下面还有种写法,我没用过,是网上别人那复制过来的
[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伪静态规则还不错吧~