Multiple domains - One public_html

NORXND

Verified User
Joined
Feb 24, 2021
Messages
16
If I have multiple domains, how can I point them all to one public_html? (Apache server)
 

NORXND

Verified User
Joined
Feb 24, 2021
Messages
16
I just want two domains to use one public_html. Not any kind of redirection.
 

Wanabo

Verified User
Joined
Jan 19, 2013
Messages
289
You could use a symlink.
home/domains/domain-A/public_html <-- is the dir you want.
Create a symlink between home/domains/domain-B/public_html and home/domains/domain-A/public_html

Do this as well for the private_hmtl directories.
 

NORXND

Verified User
Joined
Feb 24, 2021
Messages
16
You could use a symlink.
home/domains/domain-A/public_html <-- is the dir you want.
Create a symlink between home/domains/domain-B/public_html and home/domains/domain-A/public_html

Do this as well for the private_hmtl directories.
Thats it! How can I do that?
 

smtalk

Administrator
Staff member
Joined
Aug 22, 2006
Messages
9,924
Location
LT, EU
Domain alias is not a redirect, it'd open the same website when accessed, unless it's your CMS or .htaccess sending a redirect.
 

NORXND

Verified User
Joined
Feb 24, 2021
Messages
16
Domain alias is not a redirect, it'd open the same website when accessed, unless it's your CMS or .htaccess sending a redirect.
@smtalk I just set up domain pointer, go to website and then I see that I have my "base domain" in browser not this pointed one
 

smtalk

Administrator
Staff member
Joined
Aug 22, 2006
Messages
9,924
Location
LT, EU
Upload some txt file and try accessing it then :) If that's your CMS - whatever you do will result in redirect. Also, when you create the pointer, make sure "Create as an Alias" is selected (this is what I've meant with "alias" in my previous post).
 

NORXND

Verified User
Joined
Feb 24, 2021
Messages
16
Ok. I have solved it. Created one folder (with public_html, private_html etc.) then created a symlink for every domain. Thanks, @Wanabo for the help!
 

floyd

Verified User
Joined
Mar 29, 2005
Messages
5,986
Nah...as long it will work it will be good.
Its a hack. Apache tells the request to go look one place and then it gets redirected to another place. Its an extra step for each request. Pointers are the correct way. No extra steps. Its not the DirectAdmin way. Its the correct way. DirectAdmin calls them pointers but what it does is the correct way to have multiple domains point (Pointers) to the same web site. You just want to make sure to "Create as an Alias"

I am saying this not for just you but anybody else that comes along months or years later.
 

NORXND

Verified User
Joined
Feb 24, 2021
Messages
16
Its a hack. Apache tells the request to go look one place and then it gets redirected to another place. Its an extra step for each request. Pointers are the correct way. No extra steps. Its not the DirectAdmin way. Its the correct way. DirectAdmin calls them pointers but what it does is the correct way to have multiple domains point (Pointers) to the same web site. You just want to make sure to "Create as an Alias"

I am saying this not for just you but anybody else that comes along months or years later.
So If I will "Add Alias", it will not just redirect to main domain?
And It will have SSL?
 

floyd

Verified User
Joined
Mar 29, 2005
Messages
5,986
You can't have ssl for pointers.

So Zhenyapan's suggestion would be best.
 
Last edited:

NORXND

Verified User
Joined
Feb 24, 2021
Messages
16
Its a hack. Apache tells the request to go look one place and then it gets redirected to another place. Its an extra step for each request. Pointers are the correct way. No extra steps. Its not the DirectAdmin way. Its the correct way. DirectAdmin calls them pointers but what it does is the correct way to have multiple domains point (Pointers) to the same web site. You just want to make sure to "Create as an Alias"

I am saying this not for just you but anybody else that comes along months or years later.
I tried pointers. I set it up for my main domain (which leads to my site) but when I enter pointed domain it redicts me to the site that my hosting provider puts by default (something like there is no site yet. Upload it to public_html)
 

mingmeng

Verified User
Joined
Apr 11, 2017
Messages
21
Norxnd, i presume that you have setup your DNS records correctly for the domains that you want to lead to your main site - all pointing to your main domain?
Cheers
Neil
 
Top