301 redirect setup with subdomain

We have migrated a WordPress website to Webflow. It was multilingual, the main language was Spanish, and the second language was English.

URLs for the English language were as follows.

We have used Weglot on the Webflow website for translation purposes. The new URLs in the Webflow will have the language subdomain. So the new URLs will be as follows.

What is the right way to setup 301 redirects for such URLs?

301 is domain independent.

You need to set two things:

  1. To do on the www.example.com website: a redirection of the traffic from www.example.com to en.example.com, with the same address.
    For example, https://www.example.com/en/blog/coucou has to redirect to en.example.com/en/blog/coucou (yes, it’s a wrong URL but continue reading)

  2. To do on the en.example.com website: a set of 301 rules to redirect improper URLs to proper ones
    Like this: /en/blog/coucou → /blog/coucou
    You can set all the 301 in one line using wildcards, your rule is: /en/blog/(.*) → /blog/%1

Hi @vincent thank you for your answer.

The www.example.com will show content in Spanish, and en.example.com will show content in English. So setting up www.example.comen.example.com redirection will never show the Spanish content I think.