Author Topic: Domain redirect problem  (Read 13624 times)

0 Members and 1 Guest are viewing this topic.

Offline
*
Domain redirect problem
« on: July 12, 2018, 06:03:22 PM »
Hi,

I am a bit stuck with the following:

I got my CWP running: Apache & Varnish Cache & Nginx Reverse Proxy
I got 3 domains for 1 user.
a.com
b.com
c.com

Domain a.com is running a drupal site under /home/theuser/public_html
How can I make b.com & c.com redirect to a.com

Redirect and not an alias.
Or using the same homedirectory (/home/theuser/public_html) makes the same site but on 3 different urls which makes your google ranking go down because your content isn't unique)

An alias who give problems for the autossl.

When I create b.com with the default path (/home/theuser/public_html/b.com)
I got a http 500 error. Probably due to the .htaccess in the base root (/home/theuser/public_html)

Edited the vhost.conf and use the redirect option
RedirectMatch permanent ^/(.*) http://a.com/$1
This works for http sites. But not when you use https://b.com or https://c.com

Hope anyone can help me out with a good solution.

Offline
*
Re: Domain redirect problem
« Reply #1 on: July 13, 2018, 09:00:10 AM »
why not make users for the other domains? way easier!

if for some reason you can't/don't want to:

first make sure you have https for ALL domains in the user
and you'll have to add something like this in the base .htaccess

RewriteCond %{HTTPS} on
RewriteCond %{HTTP_HOST} =abc.com [NC]
RewriteRule .* https://%{HTTP_HOST}/abc\.com [L,R=301]

also . in folders is bad practice, don't do that (I'm not unsure if you have to outcomment that . in the rewriterule or not.



Offline
*
Re: Domain redirect problem
« Reply #2 on: June 20, 2020, 10:10:29 AM »
Thanks it worked 8)

Offline
*
Re: Domain redirect problem
« Reply #3 on: May 31, 2021, 12:50:06 PM »
I didn't work on Apache Tomcat :( can anyone help?
Thanks