Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have two domains hosting in two different servers: domain1.com & domain2.com

I would like to forward "blog.domain1.com" to "blog2.domain2.com" which is a Wordpress blog using CNAME redirect.

Before I installed Wordpress.

blog.domain1.com (=redirect=>) blog2.domain2.com/index.htm
(working fine)

The browser will keep the URL (http://blog.domain1.com) even the index.htm is on domain2.com server.

However, after I installed Wordpress, the browser will change the URL to (http://blog2.domain2.com)

This is my current setup:

On domain1.com DNS:

blog.domain1.com CNAME redirect to domain2.com

on domain2.com .htaccess:

Options +FollowSymLinks 
RewriteEngine On 
RewriteCond  %{HTTP_HOST} ^blog\.domain1\.com 
RewriteRule ^(.*)$ http://blog2.domain2.com/$1 [R=301,L]

on blog2.domain2.com .htaccess:

DirectoryIndex index.php
<IfModule mod_rewrite.c> 
Options +FollowSymLinks
RewriteEngine On 
RewriteBase /blog2/ 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule . /blog2/index.php [L]

blog2.domain2.com is installed under domain2.com/blog2/

All I want to do is keeping the URL (blog.domain1.com) unchanged for the whole Wordpress redirect.

share|improve this question
CNAME is an alias of a domain, not redirection. –  YOU Jun 4 '10 at 4:38

3 Answers 3

I don't think the .htaccess in blog.domain1.com will work. In your configuration, it will not never be hit. The easiest way is just remove your cname setting and keep your .htaccess in blog.domain1.com. You probably need to learn more on how DNS and Apache works.

share|improve this answer
Sorry, I mean you can put RewriteEngine On RewriteCond %{HTTP_HOST} ^blog\.domain1\.com RewriteRule ^(.*)$ blog2.domain2.com/$1 [R=301,L] in blog.domain1.com's .htaccess –  blackswan Jul 9 '10 at 6:47

In your domain2 .htaccess file replace R=301 with R=302

That tells its a temporary redirection which will keep the url address. But keep in mind, the url address will always be blog.domain1.com [even if you are reading a permalink post within domain2]

share|improve this answer
Thanks so much for your response. However, after I change it to R=302. The URL is always blog2.domain2.com (I want to keep it as blog.domain1.com even the post is hosted under domain2) Thanks! –  Vincent Chan Jun 9 '10 at 11:43

Until you can fix rewrite rules you can use Redirection Wordpress plugin:
"Manage all your 301 redirects and monitor 404 errors"

Easy to use.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.