Running two WordPress installations under one domain
Posted: December 3, 2012 Filed under: wordpress Leave a commentI had the need to maintain two WordPress sites under one domain. Originally I decided to just have them run in two sub-domains like
- site1.mysite.com
- site2.mysite.com
Later it was requested that the two sites to be run under the same domain like
- http://www.mysite.com (site1 is the default)
- http://www.mysite.com/site2
Here are some notes on how that was done.
- install two WordPress installations in directories: <home>/www and <home>/www/site2
- in the /www/site2/.htaccess, you will change the rewrite rules to
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /site2/
RewriteRule ^index\.php$ – [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /site2/index.php [L]
</IfModule> - in addition(assume the old site2.mysite.com is mapped to <home>/www/oldsite2), add a redirect rule to redirect traffic to old sub-domain.
RewriteCond %{HTTP_HOST} ^site2\.mysite\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.site2\.mysite\.com$
RewriteRule ^(.*)$ “http\:\/\/www\.mysite\.com\/site2$1” [R=301,L]