使用apache的mod_rewrite来让两个不同域名的wordpress blog共存于一个vps

比如现在j-lee.net和huizhe.name指向同一个ip,而用浏览器访问出现的却是不同的blog。(它们各自存在一个godaddy的vps下的两个目录里(Huizhe_wordpress和lijing))

原理:http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html


# BEGIN huizhe.name

RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{HTTP_HOST} .*(leen|huizhe).*
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /Huizhe_wordpress/index.php [L]

# END huizhe.name

# BEGIN j-lee.net

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} .*(j-lee).*
RewriteCond %{REQUEST_URI} !^/lijing/.* [NC]
RewriteRule ^(.*)$ /lijing$1

RewriteEngine On
RewriteBase /lijing/
RewriteCond %{HTTP_HOST} .*(j-lee).*
RewriteRule ^index.php$ - [L]
RewriteCond %{HTTP_HOST} .*(j-lee).*
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /lijing/index.php [L]

# END j-lee.net