SEO, AdWords, affiliates, advertising, and promotions
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:
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,
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
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
(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.
Regex
Fastly this is not as simple but here is some information I have written about this issue.
Go to reply 2 on this
https://moz.com/community/q/are-our-subdomains-detrimental-to-our-seo-efforts?sort=oldest
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
I know I'm a bit late with my reply. But we recently came across the same issue. For whoever it may help, the script below works for us. Just place it right below the <head> tag of your theme.liquid:
<script type="text/javascript">
document.addEventListener("DOMContentLoaded", function(event) {
if (window.location.hostname === "es.website.com") {
var newPath = window.location.pathname + window.location.search + window.location.hash;
window.location.href = "https://website.com/es" + newPath;
}
});
</script>
Cheers!
Portrait of Stephen positioned next to an image of planet Earth, with the Stephen's World ...
By JasonH Mar 18, 2024Digital marketers and app developers have tracked activity in apps and websites for yea...
By Ollie Mar 13, 2024February was an exciting month with Shopify Editions, informative webinars, and more! F...
By JasonH Mar 7, 2024