Swapping main domain and subdomain

[ad_1]

Hi all,

I’m currently managing two WordPress sites – one on my main domain and another on a subdomain, both hosted with the same provider. I want to swap the URLs of the main domain and subdomain while keeping the content on both sites intact.

To clarify:

  • I want the main domain (example.com) to have the content from the current subdomain (sub.example.com).
  • I want the subdomain to take over the content from the main domain.

So essentially, after the switch, example.com will show the content that is currently on sub.example.com and vice versa.

Does anyone know the best way to do this? I'm a noobie with very basic knowledge regarding all of this, with no one to consult.

Here’s what I’ve gathered so far:

  • Changing document roots in cPanel
  • Updating WordPress site URLs in the dashboard
  • Making sure the database and permalinks are updated correctly

But I want to make sure I don’t break anything in the process. Has anyone done this before? What’s the best approach?

[ad_2]
1 Comment
  1. Swapping domains between 2 websites is a bad idea because you’re going to break external links to your website which will harm SEO. For example, if your blogs are example.com and blog.example.com which has a post at blog.example.com/2024/10/05/example then once the swap is complete, visits to blog.example.com/2024/10/05/example will return a 404 because the actual URL for the post is now example.com/2024/10/05/example. The only way to avoid this is to set up manual redirects on both blogs for every single URL from the other blog which, depending on the size of your blogs, could be a substantial task. If you you don’t set up the redirects, you’ll immediately lose any traffic you have and search engine ranking.

    Are you sure that this is the right goal? What are you trying to achieve? Swapping domains between 2 websites is very strange, I’ve not heard of someone doing it before in my decades long career: I can come up with theories why you might want to do it, but it would be good to hear your reasoning just in case it’s the wrong solution to whatever problem you’re trying to solve.

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer