FROM CACHE - en_header

SEO - 301 redirect a subdomain to the main domain (sudirectory) with URL matching

Killian_
New Member
1 0 0

Hi Shopify community,

We are looking to redirect a subdomain like https://es.website.com/ to https://www.website.com/es/ as we need to upgrade our version of Langify from V1 to V2.

The URLs path will not change and we are looking to achieve the following:

  1. Redirect using 301 Permanent Redirect our subdomain to the main domain.
  2. Match the URL paths so that https://es.website.com/collections/collection-1 will automatically redirect to https://www.website.com/en/collections/collection-1, https://es.website.com/collections/collection-2 will automatically redirect to https://www.website.com/en/collections/collection-2, https://es.website.com/product/product-1 will automatically redirect to https://www.website.com/es/product/product-1 and so on.

Unfortunately, we can not easily add a RegEx (Regular Expression) as we could have done if we had access to the .htaccess file, like the one below :

 

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

</IfModule>

 

Any idea about the best way to achieve such redirect in Shopify?

Thanks a lot,

Replies 2 (2)
MS-WEB-DESIGNER
Shopify Partner
3012 181 489

Dear @Killian_ 

Either do it manually or use easy redirect Shopify app

Click Here to Hire Shopify Store Customization Experts
Boost Conversions & Average Order Value with this
Best App for Sticky Add To Cart
Blueprint
Shopify Partner
13 0 1

The easy way is use CloudFlare for free  you get 3 page rules these are most of the time plenty to do what you need.

 

If you do need more I believe they sell them at $5 for 10 pages rules

The time it takes you to change your DNS over to CloudFlare is literally under 15 minutes

remember when you set up the DNS for your DNS  make sure that the orange cloud is on for the subdomains you want to redirect

See the orange proxy toggle

 

Blueprint_0-1615405711099.png

 

 

CloudFlare any cast DNS is free and one of the fastest on the planet making it one of the best values in the world.

 

With the gray cloud on the DNS it acts like any other high-quality DNS however when you turn the orange cloud turns on the  proxy on.

 

You Will have on the edge regex redirects on the edge  allowing you to create redirects with regex

 

https://support.cloudflare.com/hc/en-us/articles/360037345072-Getting-Started-with-Cloudflare-Video-...

 

(DO NOT USE IT ON THE URL SERVINGS CONTENT via Shopify in your case it’s the  www)


(
Shopify uses CloudFlare already & unless you have CloudFlare Enterprise Do not use CloudFlares orange cloud on your www

but it must be on the Subdomain your redirecting to your subfolder in your example case you can use it on your bare domain only if you have a www. serving the final content.

 

Page Rule subdomains require an "Orange Clouded" DNS record for the Page Rule to work. Page Rules won't apply to subdomains that don't exist in DNS or aren't being directed to Cloudflare.

AECDD3EC-5609-4947-96E6-2DF31BA4A12C.png

https://support.cloudflare.com/hc/en-us/articles/200172286-Configuring-URL-forwarding-or-redirects-w...

 

Regex

https://support.cloudflare.com/hc/en-us/articles/218411427-Understanding-and-Configuring-Cloudflare-...

 

Fastly  this  is not as simple but here is some information I have written about this issue.

94F7F63D-210C-4B50-AAA8-2610826CF86B.png

Go to reply 2 on this

https://moz.com/community/q/are-our-subdomains-detrimental-to-our-seo-efforts?sort=oldest

 

https://moz.com/community/q/using-a-reverse-proxy-and-301-redirect-to-appear-sub-domain-as-sub-direc...

Let me know if you have any questions this whole procedure takes literally 25 minutes and it’s a very good price if you consider the cost and apps

I hope this helps,

Tom