URL rewrite blog.domain.com to www.domain.com/blog
snippet in htaccess

URL rewrite blog.domain.com to www.domain.com/blog

user1982

RewriteEngine on

RewriteCond %{HTTP_HOST}    (^|.)blog\.domain\.com [NC]
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$  http://www.domain.com/blog/$1 [L]

RewriteCond %{HTTP_HOST}    (^|.)blog\.domain\.com [NC]
RewriteCond %{HTTPS} =on
RewriteRule ^(.*)$  https://www.domain.com/blog/$1 [L]