Redirect traffic to the Hydrogen channel
These steps redirect traffic from the online store to your Hydrogen storefront. Before you begin, ensure that you've completed your Hydrogen build and tested it in development.
You should review the production checklist before launching your store on Hydrogen.
When your Hydrogen storefront is ready for launch, you might need to redirect online traffic from the online store to your Hydrogen storefront so that customers don't mistakenly land on the wrong storefront.
In this tutorial, you'll learn how to redirect traffic from the online store to your Hydrogen storefront.
Anchor to RequirementsRequirements
- You've completed your Hydrogen build and your Hydrogen storefront is ready for launch.
- You've added a domain and subdomain to your domain settings.
Anchor to Step 1: Set up the domainsStep 1: Set up the domains
This step describes how to set up a primary domain to receive traffic for the Hydrogen storefront while using a subdomain to receive traffic for the Shopify web checkout.
The hydrogen.shop demo provides an example of this routing pattern. The primary domain hydrogen.shop
receives traffic on the Hydrogen storefront while the subdomain checkout.hydrogen.shop
receives traffic at checkout.
Anchor to Update domain DNS to point to ShopifyUpdate domain DNS to point to Shopify
- Point the subdomain and the primary domain to Shopify by updating DNS records
For custom storefronts not hosted on Oxygen, only the subdomain must point to Shopify.
Anchor to Direct checkout traffic to the subdomainDirect checkout traffic to the subdomain
- From the Shopify admin, click Settings > Domains.
- For the Subdomain that you connected to Shopify, change the Target to Online Store.
- Set the domain type to Primary.
Anchor to Make the Hydrogen storefront publicMake the Hydrogen storefront public
- From the Shopify admin, under Sales channels, click Hydrogen.
- In the Hydrogen storefronts interface, select the storefront that you want to receive online store traffic.
- Click
…
beside the production environment, and then click Edit environment. - Change the URL privacy to Public, and then click Save.
Anchor to Direct online store traffic to the domainDirect online store traffic to the domain
- From the Shopify admin, click Settings > Domains.
- For the domain that you want to receive online store traffic, change the Target to the production Hydrogen storefront.
- Set the domain type to Primary.
Make sure you also update any additional redirect domains to also target your Hydrogen storefront.
Anchor to Remove password protection (if enabled)Remove password protection (if enabled)
- From the Shopify admin, under Sales channels, click Online Store > Preferences.
- In the Restrict store access section, deselect Restrict access to visitors with the password.
- Click Save.
Anchor to Step 2: Redirect visitors to the Hydrogen storefrontStep 2: Redirect visitors to the Hydrogen storefront
After going live on a Hydrogen storefront, your online store remains active. Visitors can browse online store pages if they visit your {shop}.myshopify.com
URL. If you want to serve your Hydrogen storefront to visitors who land on online store pages, then you should download and publish the Hydrogen redirect theme, which includes client-side redirection in the theme.liquid
template and a customized checkpoint.liquid
template to use with bot protection.