Dns and redirects
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
-
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. 0 -
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 CName0 -
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? 0 -
Do you just ultimately want both domains to point to the same web content?
Yes that's it0 -
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. 0
Please sign in to leave a comment.
Comments
5 comments