ricardo_mugas

Registered
Nov 16, 2022
3
0
1
Finland
cPanel Access Level
Website Owner
Hi,
So I have 2 websites :

1 - mainwebsite.com
2- secondarywebsite.com

and I have one subdomain:

1. subdomain.mainwebsite.com

I need to redirect/change DNS to a new website that will have the same domain that mainwebsite.com

What I did:

1. Create a new website ( outside cpanel world). Then I pick up the dns records and went to cpanel and change the A Records for the mainwebsite.com as the domains is the name.

Result: All good works fine

2.- I went to secondarywebsite.com and create a redirect (301 permanent) to mainwebsite.com

Result: If i go to secondarywebsite.com works fine- redirects to mainwebsite.com. If I put www.secondarywebsite.com doesnt work- Still redirects to the old one.

3. I went to the mainwebsite.com cpanel and in the A record that existed which belong to secondarywebsite.com I changed to the DNS of the website that I build. With the Cname that belongs to the secondarywebsite.com I change for A record and put the other DNS A record from the website that I build

Result: Page not found - Sorry, the requested page could not be found.

Question: Did I do ( theoretically ) all correctly and just a question of time or something I am missing here?


Thank you
 
Last edited by a moderator:

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
13,463
2,114
363
cPanel Access Level
Root Administrator
Hey there! There's two things you'd want to check. The first, would be that the DNS for the www subdomain is properly configured. If so, you'll want to check your redirect to ensure that includes www or non-www domains, as they do need separate rules.
 

ricardo_mugas

Registered
Nov 16, 2022
3
0
1
Finland
cPanel Access Level
Website Owner
Hey there! There's two things you'd want to check. The first, would be that the DNS for the www subdomain is properly configured. If so, you'll want to check your redirect to ensure that includes www or non-www domains, as they do need separate rules.
I might have explained it wrong, sorry

I try to put it in a different way and one topic at time:
For the domain secondarywebsite.com I want that it points to mainwebsite.com
If I use a redirect ( 301) what do I do with the A records that exist and CName? delete them, or let them be?
Or is it better to change the A records from the secondarywebsite.com to the mainwebsite.com and the CName
 

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
13,463
2,114
363
cPanel Access Level
Root Administrator
A 301 redirect doesn't change the DNS behavior at all. Someone makes a request for the site, they look up the DNS, they get pointed to a webserver. If that webserver then gives them a 301, that's not related to their initial DNS lookup.

Neither is necessarily better or worse, it's just how you want the site to behave. You wouldn't be able to just point the secondarywebsite.com to the mainwebsite.com through DNS and expect it to work, as something needs to happen in Apache on the mainwebsite.com end.

Do you just ultimately want both domains to point to the same web content?
 

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
13,463
2,114
363
cPanel Access Level
Root Administrator
Thanks for the clarification. There are two options then:

-if you don't have control of the destination server where maindomain is hosted, use the 301 to route secondarydomain to maindomain
-if you do have control of the destination server, you could create an Alias in cPanel >> Domains and then ensure the DNS for secondarydomain is pointed to the same IP address as maindomain

Either one will work, it just depends on what level of control you have at the maindomain server.