URL地址重写例子(Helicon)

# Helicon ISAPI_Rewrite configuration file
# Version 3.1.0.86

#RewriteEngine on

RewriteRule ^/esf/.+(/.+){4,}$ /404.aspx?$0
RewriteRule ^/esf/attn_1$ /esf/qh1/ [NC,R=301]
RewriteRule ^/esf/attn_1_sid_0$ /esf/qh1/ [NC,R=301]
RewriteRule ^/zuf/attn_1$ /zuf/qh1/ [NC,R=301]
RewriteRule ^/zuf/attn_1_sid_0$ /zuf/qh1/ [NC,R=301]
RewriteRule ^/Register/agentRegister.html$ /Register/agentRegister.aspx [NC,R=301]

##把泛域名(没有二级域名的xxxx.com)改为www二级域名
RewriteCond %{HTTP_HOST} ^xxxx\.com$
RewriteRule ^/(.*)$ http://www.xxxx.com/$1 [NC,R=301]

#RewriteCond %{HTTP_HOST} ^www\.xxxx\.com$
#RewriteRule ^/(.*)$ http://sz.xxxx.com/$1 [NC,R]

##在www域名中判断客户端浏览器有没有cookie名为114zf_site,如果有则把二级改为114zf_site的值,这是url重写组件自动判断的
#RewriteCond %{HTTP_HOST} ^www\.xxxx\.com$
#RewriteCond %{HTTP_COOKIE} 114zf_site=([^;]*)
#RewriteRule ^/(.+)$ http://%1.xxxx.com/$1 [NC,R]

##在sz、gz二级域名中改写index.html,实际访问的文件是sz_index.html、gz_index.html
RewriteCond %{HTTP_HOST} ^((sz|gz|dg|fs|zh|zs)[\d]?)\.xxxx\.com$
RewriteRule ^(/(index.html)?)?$ /%1_index.html [NC,NU]
#RewriteRule ^/((([a-zA-Z]{2})([\d])?_index.html)?)$ /$_index.html [NC,NU]

# RewriteRule ^/esf/$ /esf/attn_1_sid_0 [NC,R]
# RewriteRule ^/zuf/$ /zuf/attn_1_sid_0 [NC,R]

#格式类似,支持多选 /esf/as123-fs32_12_431_4331-aa22/
RewriteRule ^/esf/([a-z]*)/(.*) /esf/$2(?1\?rp=$1:) [NC,QSA]
RewriteCond %{QUERY_STRING} ^(.+)$
RewriteRule ^/esf/([^\.]+)/$ /esf/$1&%1?/ [NC,NU]
RewriteRule ^/esf/([a-zA-Z]{2})([\d]{1,8}(_[\d]{1,8})*)(-?([^/]*))? /esf/$5&$1=$2 [NC,LP,QSA]
#替换第一个&符号为?
RewriteRule ^/esf/&(.*) /esf/?$1 [NC,NU]

#格式类似,支持多选 /esf/as123-fs32_12_431_4331-aa22/
RewriteRule ^/xiaoqu/([a-z]*)/(.*) /xiaoqu/$2(?1\?rp=$1:) [NC,QSA]
RewriteCond %{QUERY_STRING} ^(.+)$
RewriteRule ^/xiaoqu/([^\.]+)/$ /xiaoqu/$1&%1?/ [NC,NU]
RewriteRule ^/xiaoqu/([a-zA-Z]{2})([\d]{1,8}(_[\d]{1,8})*)(-?([^/]*))? /xiaoqu/$5&$1=$2 [NC,LP,QSA]
#替换第一个&符号为?
RewriteRule ^/xiaoqu/&(.*) /xiaoqu/?$1 [NC,NU]

RewriteRule ^/zuf/([a-z]*)/(.*) /zuf/$2(?1\?rp=$1:) [NC,QSA]
RewriteCond %{QUERY_STRING} ^(.+)$
RewriteRule ^/zuf/([^\.]+)/$ /zuf/$1&%1?/ [NC,NU]
RewriteRule ^/zuf/([a-zA-Z]{2})([\d]{1,8}(_[\d]{1,8})*)(-?([^/]*))? /zuf/$5&$1=$2 [NC,LP,QSA]
#替换第一个&符号为?
RewriteRule ^/zuf/&(.*) /zuf/?$1 [NC,NU]

RewriteRule ^/jjr/([a-z]*)/(.*) /jjr/$2(?1\?rp=$1:) [NC,QSA]
RewriteCond %{QUERY_STRING} ^(.+)$
RewriteRule ^/jjr/([^\.]+)/$ /jjr/$1&%1?/ [NC,NU]
RewriteRule ^/jjr/([a-zA-Z]{2})(-?[\d]{1,8}(_[\d]{1,8})*)(-?([^/]*))? /jjr/$5&$1=$2 [NC,LP,QSA]
#替换第一个&符号为?
RewriteRule ^/jjr/&(.*) /jjr/?$1 [NC,NU]

RewriteRule ^/HouseSellHTML/house/[\d]+/([\d]{5})([\d]{3})\.html$ /sale/$1/$2.html [NC,R=301]
RewriteRule ^/RenthouseHTML/house/[\d]+/([\d]{5})([\d]{3})\.html$ /rent/$1/$2.html [NC,R=301]
RewriteRule ^/CommunityHTML/comm/[\d]+/([\d]+).*$ /commdetail/$1/ [NC,R=301]

RewriteCond %{QUERY_STRING} ^(.+)$
RewriteRule /agentShop/(([^/]+)/)?([\d]+)/?.*$ $0&%1? [NC,NU]
RewriteRule /agentShop/(([^/]+)/)?([\d]+)/?([^_]*_)?(.*) /agentShop/(?1$2:Default).aspx_shopid_$3(?4_:)$4$5 [NC,NU]
RewriteRule (/agentShop/[^\.]+\.aspx)_?([^_]+)_([^_]*)([^\?]+)? $1(?4$4&:\?)$2=$3 [NC,LP,NU]
RewriteRule /commdetail/((.*)/)?([\d]+)/?$ /commdetail/(?2$2:Default).aspx\?commid=$3 [NC,QSA]
RewriteRule /developer/((.*)/)?([\d]+)/?$ /developer/(?2$2:Default).aspx\?di=$3 [NC]
RewriteRule /agency/((.*)/)?([\d]+)/?$ /agency/(?2$2:Default).aspx\?ai=$3 [NC]

RewriteRule /s(\d{8,}) /houseDetail.aspx?id=$1 [NC]
RewriteRule /r(\d{8,}) /zf/RentalDetail.aspx?id=$1 [NC]
RewriteRule /m(\d{1,}) /MessageTax.aspx?id=$1 [NC]
RewriteRule /letters/([a-z])$ /letters/?key=$1 [NC]
RewriteRule /Activity/exchange /Activity/exchange.aspx [NC]

RewriteCond %{HTTP_HOST} sz2\.xxxx\.com$
RewriteRule ^/agent/.* http://my2\.xxxx\.com/agent/$1? [NC,R=301]

上一篇:springboot中url地址重写(urlwrite)


下一篇:Mac下 eclipse target runtime com.genuitec.runtime 解决方法