Solved

Redirect site translation from subdomain to subdirectory

Fredydb
Shopify Partner
29 1 2

Hello everyone,
I am looking for ideas and tips on how to go about the following as smoothly as possible.

I am in the process of overhauling a french-as-first-language shopify store, "mystore.com".
The domain name is bought and hosted by shopify

Currently the english translation sits at subdomain "en.mystore.com" and points to a dynamic translation service
Once the whole process is done, i am hoping to have the english version accessible at subdirectory "mystore.com/en"

I am planning to change translation method and hoping to improve the quality of the translation during the process, but otherwise page content would be similar.
Path would change from: "en.mystore.com/products/6550" to "mystore.com/en/products/6550"


Questions i have are these:

What would be the smartest way to create redirects to the english version?
Is there somewhere i can upload a rewrite rule instead of having thousands of redirect lines in the admin redirects page?
Anything i need to pay attention to in this process regarding search engines?

Thanks!

Frederic



Accepted Solution (1)
KieranR
Shopify Partner
333 27 115

This is an accepted solution.

Shopify redirects can be a bit limited for subdomains because they only take in the URL path like /old-page-path as a "Redirect from", and don't have any condition based redirect capability. So there could be some potential for conflicts and other issues with existing URLs on the site. 

To do it efficiently, I would say that you'd need to find repetitive redirect patterns, then apply rule-based conditional redirects hosted outside of Shopify. Assuming that the scale and complexity of the redirect mapping makes it possible to can construct the right rules. Could use a basic PHP/Apache web server running on a subdomain for this with .htaccess rules, but there's a few different ways to implement. 

Also, there may be an aspect of crawling and language-detecting the existing pages in order to bulk generate redirect mapping. If that's the case then might be something that at tool like Screaming Frog extraction and hreflang detection could help with.

If it's a small number of pages like less than 1k then do it 1-to-1 manually. If a lot more, then consider more technical approaches. Really depends on the scale as to what's gonna save you time.

 

Full time Shopify SEO guy, based in NZ. Sometimes freelance outside the 9-5.

View solution in original post

Replies 15 (15)

KieranR
Shopify Partner
333 27 115

One option on Shopify Advanced or Plus you can use the inbuilt international domains feature. 

They can be setup with subdomains - eg: 

  • de.johnsapparel.com
  • fr.johnsapparel.com
  • johnsapparel.com

Or a ccTLD approach like: 

  • johnsapparel.de
  • johnsapparel.fr
  • johnsapparel.com

Then you can use a language app to help with the translations.

Another common approach I see is to use multiple Shopify store instances, Paul Rogers has a good blog post on this.

Full time Shopify SEO guy, based in NZ. Sometimes freelance outside the 9-5.
Fredydb
Shopify Partner
29 1 2

Thanks for the info Kieran,
Apologies, i think i might of not been clear with this question..
The website translation WILL effectively switch from being hosted at the subdomain "en.myshop.com" to the subfolder "myshop.com/en"
I am wondering about how to efficiently build the url redirects too get customers to the content they want and not loose google juice in the process

KieranR
Shopify Partner
333 27 115

This is an accepted solution.

Shopify redirects can be a bit limited for subdomains because they only take in the URL path like /old-page-path as a "Redirect from", and don't have any condition based redirect capability. So there could be some potential for conflicts and other issues with existing URLs on the site. 

To do it efficiently, I would say that you'd need to find repetitive redirect patterns, then apply rule-based conditional redirects hosted outside of Shopify. Assuming that the scale and complexity of the redirect mapping makes it possible to can construct the right rules. Could use a basic PHP/Apache web server running on a subdomain for this with .htaccess rules, but there's a few different ways to implement. 

Also, there may be an aspect of crawling and language-detecting the existing pages in order to bulk generate redirect mapping. If that's the case then might be something that at tool like Screaming Frog extraction and hreflang detection could help with.

If it's a small number of pages like less than 1k then do it 1-to-1 manually. If a lot more, then consider more technical approaches. Really depends on the scale as to what's gonna save you time.

 

Full time Shopify SEO guy, based in NZ. Sometimes freelance outside the 9-5.
Fredydb
Shopify Partner
29 1 2

Great info Kieran, thanks!

Fanny27
Shopify Partner
15 0 6

Hi there !

How did you succeed to have the URL subfolder like "myshop.com/en" ? I'm trying to figure out how to do this for my website but I feel like Shopify doesn't offer this solution.
Thank you very much for your future answer, it's a great help.

Fredydb
Shopify Partner
29 1 2

Hi Fanny, from my experience you can't manually create subfolders in shopify.
You would need to enable multi-language & use a translation app to have "myshop.com/en" working.

Antonio_Solano
Excursionist
12 0 4

Hi Fredydb, 

I am in exactly the same situation as you were. Switching between two translation apps.

Were you successful with that change?

I'm trying to do a subdomain to subdirectory redirect but since the subdomain was generated dynamically from the translation app I can't do it in Shopify. For example es.xxx.com is converted to es.xxx.com/es not to xxx.com/es

 

Any help will be greatly appreciated.

Fredydb
Shopify Partner
29 1 2

Hi Antonio,

It's a tricky process for sure. What i found helped me most was to create a new dev store and test a bunch on how shopify's language structure & settings works and how this compares to the way my store was set up.

 

I never experienced the 'es.xxx.com/es' situation and seems you would need to address this first. I feel this would create a redirect loop using my solution. Some could depend on how the original translation app set things up and how the new one is taking over...you might need to contact app support for this. I found the language switcher widgets installed by the apps sometime plays tricks on you,

 

Anyhow this worked for me (i am assuming here es is your secondary language)

1. Made sure www.mysite.com/es was accessible and functional on it's own

2. As per Kieran's insight, i purchased a hosting plan with ssl certificate outside Shopify.

3. Installed a .htaccess url rewrite rule on this provider's server that redirects incoming traffic to mysite.com/es

4. Tested that rule a bunch to make sure it did exactly what it was supposed to do

5. My domain is purchased with Shopify, so in my domain DNS settings, i located the 'es' subdomain in the cname pane. This was pointing to the old translation app server. Changed it to point to the new provider

 

The idea is anyone accessing through an older link (google included) will be redirected to the subfolder ex:    es.mysite.com/page > https://www.mysite.com/es/page

Antonio_Solano
Excursionist
12 0 4

Wow Fredydb, many thanks. Sorry because I insisted you with a DM but here is the solution!.  That's what I need.  

 

Antonio_Solano
Excursionist
12 0 4

Hi Fredydb, everything was going fine until reach the rewrite rule for the .htaccess file... What would be the code to be written there?

Antonio_Solano
Excursionist
12 0 4

Forget my last message. I used:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !^www.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/es [R=301,L]
</IfModule>

Crossing fingers while waiting for checking it's propagated and working

Antonio_Solano
Excursionist
12 0 4

It didn't work... now as emergency solution they wrote:  

RedirectMatch 301 ^(.*)$ https://xxxxx.com/es but now every single page from the subdomain goes to the root: thetravelerart.com/es

I'll appreciate a lot some help with wildcard redirection from your part. From https://es.xxxxx.com to https://xxxxx.com/es

Thanks

Antonio_Solano
Excursionist
12 0 4

Finally! I found the solution here on Aleyda Solis's blog. Great tools for people like me who don't know how to write a single line of code.

This is working like a charm:

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^(.*)$ https://xxxxx.com/es/$1 [L,NE,R=301]

</IfModule>

MrKOYO
Excursionist
21 1 6

Hi @Antonio_Solano 

 

I have same issue like you, can you help me a little, 

 

I don't understand how you got access to htaccess what to prescribe this code?

Antonio_Solano
Excursionist
12 0 4

Hi @MrKOYO I just did what @Fredydb  recommends in a post above applying the rule I got from aleydasolis web