I have two domain names setup with sub-domains as follows...

blog.domain.com
www.blog.domain.com

blog.domain.info
www.blog.domain.info

Both domains are pointing to the same location on the same server, a directory containing WordPress. (domain.com/blog)

To keep Google happy, I want everything to redirect to this one domain...

blog.domain.com

Here is what's inside the .htaccess file contained in the WordPress directory...

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

So I went into my cPanel and added a 301 Domain Redirect as follows...

blog.domain.info -> blog.domain.com (with "www" optional and wildcard selected).

cPanel then automatically added the following to the same .htaccess file under the WordPress rewrite rules...

RewriteCond %{HTTP_HOST} ^blog.domain.info$ [OR]
RewriteCond %{HTTP_HOST} ^www.blog.domain.info$
RewriteRule ^(.*)$ "http\:\/\/blog\.domain\.com$1" [R=301,L]

The problem is that the wildcard portion does not seem to work.

When I go to blog.domain.info, I get redirected to blog.domain.com as expected.

But when I go to blog.domain.info/my-post, I do not get redirected at all.

  1. How can I fix this? I've tried rewrite rules that I know work but all I can think of is that the WordPress rules are interfering.

  2. Once it's fixed, can I move these mod-rewrites to the main .htaccess in the hosting account's www root keeping them separate from the WordPress rules? Edit: Answer- NO, they will not work because they are domains parked in directories off the root www.

    Edit
    Report