Redirect domain to sub-domain

AMuseum

Registered
May 18, 2022
2
1
3
UK
cPanel Access Level
Website Owner
My knowledge of cPanel is fairly basic so some advice would be appreciated before making changes that crash everything.

We currently have an add-on domain that we would like to move to a sub-domain but direct the add-on domain name to the sub-domain. Both sites are run on Wordpress. By default a sub-domain has been created on C-Panel but typing the sub-domain into a browser directs to the add-on domain.
We would prefer to shorten the sub-domain name. The add-on domain files are in a folder in the account root.

Current:
Primary Domain: domain.sld.tld
Add-on Domain longname.tld
Sub-domain longname.domain.sld.tld directs to longname.tld

We would like:
Primary Domain: domain.sld.tld
Sub-domain: name.domain.sld.tld
Add-on domain longname.tld directs to name.domain.sld.tld

I presumably need to create a new sub-domain name.domain.sld.tld. Can I then set the root for the sub-domain to that for the add-on or do I need to copy the add-on files to a new folder and point the add-on domain name to the new folder?
Is having the address shown in the address bar as the sub-domain a matter of changing the site settings in Wordpress (together with any internal links) or is there another setting I need to change in cPanel?

Shared hosting account
cPanel 100.0 on Linux
 
Last edited by a moderator:

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
12,499
1,971
363
cPanel Access Level
Root Administrator
Hey there! I would do the following to ensure there is no overlap or confusion:

-create name.domain.sld.tld
-copy data from longname.tld to name.domain.sld.tld. If you're using WordPress Toolkit you can actually use the "clone" feature to completely clone the site and it will handle all the odd WordPress values, like siteurl, to ensure they are pointed to the right area of the server
-confirm things are working well on the new subdomain
-remove the longname.tld addon
-create longname.tld through cPanel >> Domains and just adjust the document root that it points to, as that creates an alias in the Apache configuration.

At that point, things should be working well! I'd strongly recommend having a backup of the account created before you start any destructive work like this, just in case things don't go as planned and you need to restore.