一些有用apache重写规则
# 将domain.com/xxx转向www.domain.com/xxxRewriteCond %{HTTP_HOST} ^domain.com [NC]RewriteRule ^(.*)$ http://www.domain.com$1 [R=301,NC]# 将xxx.domain.com/yyy...重定向到www.domain.com/xxx/yyy..., xxx 5-20位, 字母开头只含字母, 数字以及"-"和"_"RewriteCond %{SERVER_NAME} ^([a-z][a-z0-9\-\_]{4,19})\.domain\.com [NC]RewriteRule ^(.+)$ %{SERVER_NAME}$1 [C]RewriteRule ^([a-z][a-z0-9\-\_]{4,19})\.domain\.com(.*)$ http://www.domain.com/$1$2 [R=301,NC]# 将首页www.domain.com转向www.domain.com/html/index.htmlRewriteCond %{HTTP_HOST} www\.domain\.comRewriteRule ^/$ http://www.domain.com/html/index.html [R=301,L]
Tags: apache, url_rewrite
