eitanc

Active Member
Jan 31, 2010
40
4
58
Hello,

I wish to have a domain alias for an already running site that use other domain name.
Say, I wish that domain2.com will be an alias for domain1.com.

I wish to avoid redirects as much as possible - so I went with the alias feature and not the redirect feature.

But, the alias feature only selects the root of my public_html directory, while the site is at public_html/domain1 folder and in the cPanel GUI I cannot set it to be so, so the cPanel GUI force me to do a redirect for the alias for things to work - and so we ended up using a redirect...

Is there a way to simply select the needed sub-directory for the alias and so not use a redirect?

Thanks!
 

cPanelLauren

Product Owner
Staff member
Nov 14, 2017
13,296
1,271
313
Houston
Hello,


Aliases are essentially created for a domain that's going to display the contents of another domain. Meaning it's not going to do what a wildcard redirect will do (i.e., redirect domain.tld/folder to sourcedomain.tld/folder) If your domain is at domain.tld/folder and you want to alias it to domain.tld you would have to add a redirect for it to work. What is it about redirects that you're not wanting to use?
 

eitanc

Active Member
Jan 31, 2010
40
4
58
I know what is an alias, but why can't I set it to show the content of 1 level sub-folder of the public_html root folder?

I try to make the alias domain pre-loaded in the HSTS list, at HSTS Preload List Submission, but I get rejected with an error message of:
"
Error: Too many redirects
There are more than 3 redirects starting from hxxp://vigorous.co.il:
"
1. domain.co.il - http to https
2. domain.co.il - https to hxxps://vsec.co.il (this is the cpanel alias redirect, the one I wish to omit)
3. internal domain.co.il domain redirect from the root to a specific page - hxxps://domain.co.il/he/about-heb/
(see all at HTTP Status Codes Checker ~ Server Header Response Code Checking Tool)
 
Last edited by a moderator:

cPanelLauren

Product Owner
Staff member
Nov 14, 2017
13,296
1,271
313
Houston
You can't do this because you can't create an alias of domain.tld/folder - aliases are of the domain not the domain + directory this won't work when added to the VirtualHost

You can read about what a ServerAlias is and how they work here: core - Apache HTTP Server Version 2.4

When you submit a domain for HSTS preload you must include a redirect from http to https and an HSTS header so excluding the redirect would not serve your purpose.
 

eitanc

Active Member
Jan 31, 2010
40
4
58
OK, I looked into this - and all you needed was to advise me to use an "addon domain" instead of alias to solve this, as this solved the issue since it allows me to set a public own/self domain to use specific existing sub-folder of public_html.

BTW, I think there is a typo at Redirects | cPanel & WHM Documentation - at step 3 "directory.file.html" should be "directory/file.html"