Case Study: Why and how we migrated our blog from a subdomain to a subdirectory
Learn how our team successfully migrated our blog from a subdomain to a subdirectory, resulting in significant improvements in website ranking and traffic. Discover the challenges we faced during the process and how we overcame them to ensure a seamless transition.
Introduction
Hosting a party is always exciting, isn't it? You spend hours planning the guest list, decorations, and food. But, have you ever had a moment during the party where you realize that everyone is split up and not enjoying the party to its full potential? It's like everyone is having fun, but not together.
That's how we felt about our blog. We had created great content that was drawing in traffic, but we realized that it wasn't benefiting our main website as much as it could be. It was like we had thrown a party, but some of our guests were having fun in a separate room while the main area wasn't getting the full benefit of their presence.
After careful consideration, we decided to make a change to improve the synergy between our blog and main website. We decided to migrate our blog from a subdomain to a subdirectory structure.
In this case study, we want to share our journey of migrating our blog and the steps we took to improve the synergy between our blog and main website. We'll also discuss the potential risks of such a migration and offer tips for making a similar change. So, come along with us on our journey of blog migration and let's make the most of our party!
The Why
Are subdomains or subdirectories better for your website's SEO efforts? It's a question that's been debated by experts for years, and one that we here at Sych had to grapple with ourselves. Our blog had been living on a subdomain for sometime, but we were starting to wonder if it was really the best option for us.
According to various technical studies, search engines often view subdirectories as internal links to the main domain, while subdomains are treated as separate entities. This means that subdirectories may pass on more authority to the main website than subdomains do. One way to think about it is that the content on the subdomain is treated as if it's on a completely separate domain when it comes to ranking. This can make it easier to understand the potential impact on your website's SEO.
On the contrary, a subdomain structure would be more suited when the content on the subdomain is meant to have a distinct purpose or function from the main website. For example, if you have a separate service or product offering that requires a different design or user experience, then it could be beneficial to have it on a subdomain. This way, users can easily distinguish between the main website and the subdomain, and the subdomain can have its own unique branding and SEO strategy. Another example is if you have a separate language version of your website, a subdomain for each language can be an effective way to organize and target the content. Ultimately, it all comes down to what best aligns with your goals and how you want to structure your website's content.
For us, it became clear that having a blog subdomain was not benefiting our main website's SEO efforts as much as we had hoped. Despite the increasing traffic on our blog subdomain, our main website was not ranking higher on Google search results. Our blog subdomain would always show up at least 2 pages ahead of the root domain on search results which was not what we wanted. This led us to believe that switching to a subdirectory structure would align better with our goals of generating traffic and boosting our main website's search rankings.
In the end, the decision to migrate our blog from a subdomain to a subdirectory was not an easy one, but we feel confident that it was the right one.
So, if you're in a similar situation, it's worth considering the benefits and drawbacks of both subdomains and subdirectories before making a decision. While there may not be a one-size-fits-all answer, doing your research and considering your specific goals can help you make the best decision for your website.
The How
The 'how' was a different story altogether. It was more complicated than we anticipated. We had an existing blog, with backlinks all across the internet, and we needed to migrate it to a subdirectory structure without losing any of that precious link juice. It was a daunting task, but we were determined to see it through.
Previous Setup
When we first started our blog, we set it up as a dedicated web application running on multiple server nodes with a load balancer on top and a reverse proxy. It was a robust setup that ensured fast load times and high availability.
Challenges and Considerations for Migration
The challenges faced during the migration were numerous and required careful consideration to ensure a seamless transition:
- Existing blog with backlinks: We had an existing blog with backlinks all across the internet, which had to be preserved to avoid losing valuable traffic and search engine rankings.
- Duplicate content issues: We couldn't have kept two URLs pointing to the same application due to duplicate content issues that Google penalizes for.
- Separate applications: Our root domain website was a separate application from the blog, which presented a challenge in making the subdirectory of one application point to another without issues.
- Technical complexities: The migration required complex technical considerations, including the setup of redirect rules, domain mapping, and server configurations.
Despite these challenges, we were determined to move forward with the migration to a subdirectory structure to achieve our goals of increased traffic and improved search engine rankings. In the following section, we'll discuss how we addressed each challenge and successfully migrated our blog to a subdirectory structure.
New Setup
Step 1: Enable Rewrites on the Root domain's Reverse Proxy
We updated our main website's Nginx configuration to rewrite requests coming for sych.io/blog
to blog.sych.io/blog
.
To elaborate, this rewrite occurs within the server, and it is not visible to the user as the browser's address bar remains unchanged.
You might also notice that we are rewriting to blog.sych.io/blog
instead of the blog.sych.io/
. The reason why the URL is rewritten this way is because if it is simply rewritten to the /
path, any resources like images, CSS files, or JavaScript files on the blog's page that are being accessed from a path different from the root would break. By keeping the same path in the request, the server is able to serve content seamlessly without any broken links or resources. Of course there are other ways to deal with this, but we made a decision that wouldn't add unnecessary complexity.
Step 2: Update Blog Application's Root Path
Since the requests were being rewritten to blog.sych.io/blog
, the Blog application was also reconfigured to serve at the /blog
path by default versus the original /
path it served before.
Step 3: Enable Redirects on the Blog subdomain's Reverse Proxy
We also updated our Nginx configuration that sat on top of the blog server's load balancer to forward all /blog
requests but redirect requests for all other paths with a 301 - Permanent Redirect
to sych.io/blog
.
Step 4: Update Canonical Urls
Most importantly, we had to ensure that Google does not penalize our root domain for duplicate content available on the subdomain so we updated our blog application to use sych.io/blog
as the base for all canonical urls.
Step 5: Update Google Search Console
To inform Google about the migration, we navigated to the Search Console dashboard of blog.sych.io
and accessed the "settings" section. From there, we selected "change of address" and provided the new URL, which was sych.io/blog
. Google verified the change by confirming that 301 redirects were enabled.
Additionally, we submitted the sitemaps for our blog under the dashboard of our root domain in the Search Console. Alternatively, we could have included links to all sitemaps in the root domain's Robots.txt
file, which would allow crawlers to index them.
Summary of Changes
To ensure a seamless transition from subdomain to a subdirectory, we reconfigured our reverse proxy for the root domain that rewrote all requests coming for sych.io/blog
to blog.sych.io/blog
. The blog subdomain's reverse proxy was also reconfigured to forward all /blog
requests to the blog application but redirect requests for all other paths back to sych.io/blog
.
In other words, when a user types in sych.io/blog
in their browser, the reverse proxy for the main website recognizes the request and rewrites it to blog.sych.io/blog
. From there, the reverse proxy for the blog application forwards the request to our blog application, which then serves the appropriate content.
This setup not only allowed us to preserve our existing traffic and backlinks but also ensuring that there were no duplicate content issues that could harm our SEO. It is not the simplest of setups, but we worked tirelessly to ensure that it was implemented smoothly without any disruptions to our users.
Result
Finally, after pesistent hard work and careful planning, we were thrilled to see the positive impact of our migration. Our team put in countless hours to ensure that the transition was seamless and that all potential challenges had been addressed. We were proud to report that our efforts had paid off with significant improvements in our website's ranking and traffic.
Conclusion
As we wrap up our subdomain to subdirectory migration journey, we can't help but feel a sense of pride and accomplishment. It's been a challenging yet rewarding experience that has taught us the value of strategic planning, effective communication, and teamwork. Throughout the process, we faced a variety of obstacles and uncertainties, but we persevered and emerged stronger than ever. Seeing the positive impact on our website's ranking and traffic is a testament to our hard work and dedication. We hope that by sharing our experience, we can inspire others to take on similar challenges and achieve great results!
If you're considering a similar migration for your own website, we can't recommend it enough. But we also understand that it's a complex and challenging process, one that requires careful planning and attention to detail. That's where Sych comes in. Our team of experts can help guide you through every step of the way, ensuring that your migration is a success and your web applications continue to thrive. Don't hesitate to reach out to us and learn more about how we can help you achieve your goals.