0

My story is:

I use module Domain Access for Multi domain feature and Internationalization, Domain Variable for the multilingual features. I have these domains:

  • www.domain-a.com (main domain)
  • www.domain-b.com
  • www.domain-c.com

All is set to use www. prefix.

Now I have www.domain-d.com.au replacing www.domain-c.com. So I delete www.domain-c.com from Domain list in Drupal and add www.domain-d.com.au.

I also set redirect. So when user visit www.domain-c.com or domain-c.com, they'll redirected to www.domain-d.com.au. I add a rule in .htaccess:

RewriteCond %{HTTP_HOST} ^www.domain-c.com$ [NC,OR]
RewriteCond %{HTTP_HOST} ^domain-c.com$ [NC]
RewriteRule ^(.*)$ http://www.domain-d.com.au/$1 [L,R=301,NC]

Result is:

  1. Visit www.domain-d.com.au. Page opened OK.
  2. Visit domain-d.com.au, redirected to www.domain-d.com.au
  3. Visit www.domain-c.com, redirected to www.domain-d.com.au
  4. Visit domain-c.com, not redirected (fail).

Question is:

How to make domain-c.com to redirect to www.domain-d.com.au? Is here something wrong with my .htaccess.

I uncomment the with www. prefix in Drupal .htaccess and add the rule right below the

...

# Various rewrite rules.
<IfModule mod_rewrite.c>
  RewriteEngine on

...

1 Answer 1

0

You have domain aliases with Domain Access, so you can edit your www.domain-d.com.au domain and add aliases that you need with redirection rule.

When you edit the domain you'll notice Aliases tab, there you can find explanation how to create the pattern and you just add the pattern that you need.

So, you don't need .htaccess for this.

2
  • Thank you! I've tried it before but not working, probably got mixed up with the .htaccess. After removing the .htaccess rule, clear cache, it's working now.
    – Permana
    Jul 21, 2016 at 11:42
  • After few days, I just realize after trying to open in another browser, that redirection is not working. I add domain-c.com (301 redirect) and www.domain-c.com (also 301 redirect) to domain-d.com.au domain alias. .htaccess rule have been removed. It works if I use chrome (probably chrome cache?) but not in another browser.
    – Permana
    Jul 25, 2016 at 1:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.