在网站根目录下添加.htaccess
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(blog\.)?xiaokyun\.com$
RewriteRule ^blog/(.*)$ http://blog.xiaokyun.com/$1 [L,QSA,R=301]
RewriteCond %{HTTP_HOST} ^blog\.xiaokyun\.com$
RewriteCond %{REQUEST_URI} !^/blog/
RewriteRule ^(.*)$ /blog/$1 [L,QSA]
在子目录下添加.htaccess
RewriteEngine On
RewriteBase /blog
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]