如何mod_rewrite子域名? [重复]

I have a wordpress blog in the folder /public_html/blog/ and a subdomain pointing to it: blog.domain.com. Now I have changed the domain of my blog so it should be visited directly by domain.com/blog which worked fine. Also the subdomain still exists and redirects to to domain.com/blog. However, all my old links to my blog posts still point to blog.domain.com/p/111 for example. How can I use a mod_rewrite rule so that when someone visits blog.domain.com/xyz/xyz they see domain.com/blog/xyz/xyz instead?

</div>

Add this to your .htaccess

RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} ^blog\.domain\.com [NC]
RewriteRule ^(.*)$ http://domain.com/blog/$1 [R=301]