apache .htaccess 多域名、www重定向

2011-08-17 10:35  1731人阅读  评论 (0)

.htaccess

RewriteEngine on
//多域名重定向   
RewriteCond %{HTTP_HOST} ^blog.dotcoo.com$ [NC]
RewriteRule ^(.*)$ http://www.dotcoo.com/$1 [R=302,L]
//www和非www选择
RewriteCond %{HTTP_HOST} ^dotcoo.com$ [NC]
RewriteRule ^(.*)$ http://www.dotcoo.com/$1 [R=302,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteBase /
RewriteRule . /index.php [L]