CNAME redirect to Wordpress blog not working (.htaccess problem)
Posted
by Vincent Chan
on Server Fault
See other posts from Server Fault
or by Vincent Chan
Published on 2010-06-04T04:32:21Z
Indexed on
2010/06/04
6:10 UTC
Read the original article
Hit count: 367
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]
</IfModule>
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.
Thanks a lot.
© Server Fault or respective owner