.htaccess写法和httpd.ini写法

apache .htaccess


RewriteBase /  #目录名字
RewriteEngine on  #打开引擎
RewriteRule #匹配规则 #跳转路径

 

例:

 

RewriteBase / 

RewriteEngine on 

RewriteRule ^test.html$ test.aspx

RewriteRule ^test-([0-9]+).html$ test.aspx?id=$1

RewriteRule ^test-([0-9]+)-([0-9]+).html$ test.aspx?pid=$1&id=$2


iis httpd.ini


 [ISAPI_Rewrite]


# 3600 = 1 hour
CacheClockRate 3600


RepeatLimit 32


# Protect httpd.ini and httpd.parse.errors files
# from accessing through HTTP

#参考

RewriteRule ^(.*)/archiver/((fid|tid)-[0-9]+\.html)\?*(.*)$ $1/archiver/index\.php\?$2&$4
RewriteRule ^(.*)/forum-([0-9]+)-([0-9]+)\.html\?*(.*)$ $1/forumdisplay\.php\?fid=$2&page=$3&$4
RewriteRule ^(.*)/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html\?*(.*)$ $1/viewthread\.php\?tid=$2&extra=page\%3D$4&page=$3&$4
RewriteRule ^(.*)/space-(username|uid)-(.+)\.html\?*(.*)$ $1/space\.php\?$2=$3&$4
RewriteRule ^(.*)/tag-(.+)\.html\?*(.*)$ $1/tag\.php\?name=$2&$3


#例
RewriteRule ^(.*)/default\.html  $1/default\.asp
RewriteRule ^(.*)/info\.html\?base_id=(.*)  $1/info\.asp\?base_id=$2
RewriteRule ^(.*)/info\.html\?base_id=(.*)&second_id=(.*)  $1/info\.asp\?base_id=$2&second_id=$3
RewriteRule ^(.*)/display\.html\?id=(.*)  $1/display\.asp\?id=$2


 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值