RewriteEngine on
RewriteCond %{HTTP_HOST} ^blog.chosenet.com$
RewriteCond %{REQUEST_URI} !^/blog/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /blog/$1
RewriteCond %{HTTP_HOST} ^blog.chosenet.com$
RewriteRule ^(/)?$ blog/ [L]
RewriteCond %{HTTP_HOST} ^bbs.chosenet.com$
RewriteCond %{REQUEST_URI} !^/bbs/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /bbs/$1
RewriteCond %{HTTP_HOST} ^bbs.chosenet.com$
RewriteRule ^(/)?$ bbs/ [L]
RewriteCond %{HTTP_HOST} ^blog.chosenet.com$
RewriteCond %{REQUEST_URI} !^/blog/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /blog/$1
RewriteCond %{HTTP_HOST} ^blog.chosenet.com$
RewriteRule ^(/)?$ blog/ [L]
RewriteCond %{HTTP_HOST} ^bbs.chosenet.com$
RewriteCond %{REQUEST_URI} !^/bbs/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /bbs/$1
RewriteCond %{HTTP_HOST} ^bbs.chosenet.com$
RewriteRule ^(/)?$ bbs/ [L]
//可以实现多文件的二级域名冲重定向
RewriteCond %{HTTP_HOST} ^(.*).chosenet.com$
RewriteCond %{REQUEST_URI} !^/%1/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /%1/$1 //运行路径blog.chosenet.com
RewriteCond %{HTTP_HOST} ^(.*).chosenet.com$
RewriteRule ^(/)?$ %1/ [L]