All things Shopify and commerce
I currently have the subdomain: pufferhug.com and would that url to link to a different page (that's created on shopify). I know shopify allows redirects for internal links, though this feature didn't have anything for my specific case.
Is this something that's possible? If so, what's the best way to redirect?
Thanks!
Hey @GScreative.
Thanks for reaching out.
I appreciate that you have let us know which domain you are using. For all domains that are connected to Shopify, they are connected to the entire Shopify account rather than a page or collection in particular. There are pages and collections for your website that are created within your account, but the domains are connected with the account in general. For that reason, there isn't a way to connect the subdomain to a specific product or collection page on its own.
I can definitely see how this would be beneficial to allow on the platform and I can provide this as a suggestion to our developers. With that being said, you're able to adjust the last part of the collection or product domain to whatever you like.
As an example, if your collection is called "Cool Shades" and you wanted the URL to say something like "Sun Glasses" you could change it from www.yourdomain.com/collection/coolshades to www.yourdomain.com/collection/sunglasses. In order to do that you can go into your collection directly and click on the SEO editor at the bottom of the page. I took a screenshot from my test store to show you the section I am referring to:
Once you select on Edit SEO, you should then be able to add a custom end of the URL.
Looking forward to your reply, let me know if you have any additional questions.
Ollie | Social Care @ Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit the Shopify Help Center or the Shopify Blog
Thanks for your response. We want the url of "pufferhug.com" to redirect to a different page. So when that url is entered, it takes them to another page instead of 'pufferhug.com'.
Hello @Ollie
Thanks for the response! We want the url of "pufferhug.com" to redirect to a different page. So when that url is entered, it takes them to another page instead of 'pufferhug.com'. This other page is a page hosted by Shopify.
We want our homepage of “pufferhug.com” to forward/redirect to a different landing page we created for a faux-store front.
I am also requesting this feature
I'd like to request this feature as well if Shopify can figure out a way to have the Alias Domain redirect to a specific page 🙂
To further clarify my post above, you must set this up in your DNS hosting provider (usually that's the same as your domain registrar, but not always, ie GoDaddy, CloudFlare, etc.). You must first create a placeholder DNS AAAA record for that specific subdomain with the value of "100::". (see first screenshot).
Then create a Redirect Rule to send the subdomain traffic to a page URL (see second screenshot).
In my examples, I am sending buy.dermeleve.com to a specific product page within our store that also applies an automatic discount. (https://dermeleve.com/discount/NEWPATIENT?redirect=/products/dermeleve%C2%AE-cream)
This cannot be done for a subdomain in Shopify's redirects; only pages after the .com (for example domain.com/*from-here*. to domain.com/*to-wherever-you-want-here*.
Hope that's helpful!
I'd like to request this feature too. We want to point a subdomain to a specific page in our store. for example we want to point "promo.xxxxxxxx.com" to xxxxxxxxx.com/pages/promo. Or buy.xxxxxxx.com to xxxxxxx.com/pages/whatever
Setting up Forwarding URLs in CloudFlare doesn't seem to work. Also setting up their new Redirect Rules doesn't work either.
Does Shopify somehow block these?
Hi - you can make it work with a little javascript.
Add your Subdomain as a single domain to Shopify Domains. There choose "Alias for Domain" (third option).
Now in your theme.liquid in the header do the following:
<script> if(document.location.href.indexOf('testthis') > -1) { document.location.href = 'http://www.test.com'; } </script>
just change "testthis" to whatever your special subdomain or domain part is. Then change www.test.com to the url you want to forward to.
I know it is not just configurativ and it would actually be nice if Shopify's forwarding system would allow to choose the domain base path as startingpoint uf a forward instead of just the path
but nevertheless it's maintainable by yourself without the need to spin up a proxy
This works great!
EXCEPT I'm running into one issue. Not only is it forwarding my subdomain, it's also forwarding a page I have set up with the same name. To be specific:
I wanted to forward https://warranty.whisperearcare.com to a Tally form to collect data. This is working great!
However, this page is also being forwarded to the same place https://whisperearcare.com/pages/warranty
Is there any way to ONLY forward to subdomain, but leave the page above without any url forwarding?
You can focus on the domain specifically. The above example was more a "search" within your location. If you change it to the following it's more explicit:
<script>
var host = window.location.host;
var sub = host.split('.')[0];
if(sub == 'testthis') {
document.location.href = 'http://www.test.com';
}
</script>
So you check the host, then take the first part and if that matches your "searchword" you do the forward.
Pay attention - if your domain is something like my.warranty.yourdomain.com then the script above would give you "my" as the first part. e.g. you need to change your split to [1] to give you "warranty" as your searchword.
THANK YOU!
Now my problem is totally solved. Really appreciate your help 🙂
wait so i can add this to the back end and get a second url with an ssl (https://dc20.com) to redirect to the page we need it to go to (https://thedungeongcoach.com/dc20 )?
In that case it's a second domain dc20.com ? You can specifiy a forward directly at your hoster.
if you want to do it with javascript you would need to use the first script which looks for dc20.com
i would adapt it to just look at the host instead of the full href. because else the script would also trigger on the subpage and you would have a redirect loop
<script> if(document.location.host.indexOf('dc20.com') > -1) { document.location.href = 'https://thedungeongcoach.com/dc20'; } </script>
I can't seem to get this to work. Am I doing something wrong? Added the code to the theme.liquid header. I need waldocropmaze.com to redirect to brazeranch.com/pages/cropmaze
I'm curious would this exact script also work if someone visited waldocropmaze.brazeranch.com ?
as "waldocropmaze" is the subdomain it would work as theme.liquid is the same. as long as you search in the href.
again see https://github.com/nirjan-dev/learning-to-code/issues/370 for a clear image of URL parts
In that case you have a domain and not a subdomain. like subdomain.waldocropmaze.com you would need to use the first script:
Check https://github.com/nirjan-dev/learning-to-code/issues/370 for help. As you have a domain only I would specifically search in the host part
<script> if(document.location.host.indexOf('waldocropmaze.com') > -1) { document.location.href = 'http://www.brazeranch.com/pages/cropmaze'; } </script>
Oh my goodness. You get the "most amazing human being" award today. Thank you!!!!
@andgamb nice work!
Would we need to copy paste this multiple times, if, for example, we had 12 sub-domains, redirecting to 12 specific collection pages?
In that case I would suggest looking into the Switch Statement: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/switch?retiredLocale=de
it would look something like this, just add all your cases:
<script>
var host = window.location.host;
var sub = host.split('.')[0];
switch (sub) {
case 'SUBDOMAIN1':
document.location.href = 'http://www.test.com';
break;
case 'SUBDOMAIN2':
document.location.href = 'http://www.test2.com';
break;
default:
document.location.href = 'http://www.default.com';
}
</script>
just written that down - completely untested!
Hi,
I'm experiencing the same issue and tried following your steps, but I think I might be doing something wrong. The subdomain is still directing to the home page instead of the specific page I want.
The subdomain is: www.beauty.kaimok.com
The page I want to redirect to: https://www.kaimok.com/pages/beauty
Additionally, the URL now looks different with the subdomain.
What can I do to fix this?
Thanks, I have tried on Shopify domain page, but it doesn't work.
It always goes to the main page.
Should I put the subdomain as Alias?
What about the DNS?
thanks
Starting a B2B store is a big undertaking that requires careful planning and execution. W...
By JasonH Sep 23, 2024By investing 30 minutes of your time, you can unlock the potential for increased sales,...
By Jacqui Sep 11, 2024We appreciate the diverse ways you participate in and engage with the Shopify Communi...
By JasonH Sep 9, 2024