Pointing forwarded domain to a specific page

mreynolds
Excursionist
26 0 5

Hi, I have a site I need to point to a certain page on the parent site. This site is hosted on Network Solutions which charges to use domain forwarding. I researched how to avoid this charge and went through all steps to forward the domain to the parent site. However, it now points to the home page of the parent site and not the page. 

 

The domain is buttonandsqueaky.com.

The parent site is jimshore.com.

The page I need it to point to is https://jimshore.com/pages/button-and-squeaky-by-jim-shore

Is there a way to point this domain to this page by adding code of some kind in the liquid file(s)?

 

Thanks,

Margie Reynolds

Replies 3 (3)
Moira
Shopify Staff
Shopify Staff
1807 205 275

Hey @mreynolds,

 

You can use a Shopify app like "Page Redirect" to redirect the buttonandsqueaking.com domain to the specific page on jimshore.com.

 

You can also add code to your Shopify theme's liquid file to redirect the domain to the specific page. Here is an example of the code you can use:

 

{% if request.host == 'buttonandsqueaking.com' %}
    {% redirect 'https://jimshore.com/pages/button-and-squeaky-by-jim-shore' %}
{% endif %}

 This code will check if the host of the current page is 'buttonandsqueaking.com', and if it is, it will redirect to the specific page on jimshore.com. Please, bear in mind that this will redirect all traffic to buttonandsqueaking.com to the specific page, you may want to consider that before proceeding.

Moira | 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

mreynolds
Excursionist
26 0 5

Hi Moira,

 

Would I place this code inside the <head> code or at the bottom above </body>? I just tried placing this in the theme.liquid file above the </head> tag and it threw the following error:

  • Liquid syntax error (line 230): Unknown tag 'redirect'

Here is the code I'm placing in the file:

 

{% if request.host == 'buttonandsqueaky.com/' %}
{% redirect 'https://jimshore.com/pages/button-and-squeaky-by-jim-shore' %}
{% endif %}

Moira
Shopify Staff
Shopify Staff
1807 205 275

@mreynolds 

 

The code I provided should be placed in the theme's theme.liquid file, but it should be placed inside the <head> section and not above it. The </head> tag is the end of the head section, so any code placed above it would not be executed.

 

Regarding the error message "Unknown tag 'redirect'" it seems that the 'redirect' is not a valid liquid tag, I apologize for my previous response,

 

A possible solution would be to use a javascript redirect instead. You can add the following code to your theme's theme.liquid file, inside the <head> section:

 

{% if request.host == 'buttonandsqueaking.com/' %}
    <script>
        window.location.href = "https://jimshore.com/pages/button-and-squeaky-by-jim-shore";
    </script>
{% endif %}

 This will check if the host of the current page is 'buttonandsqueaking.com', and if it is, it will use javascript to redirect the user to the specific page on jimshore.com. Please, bear in mind that this will redirect all traffic to buttonandsqueaking.com to the specific page, you may want to consider that before proceeding.

Moira | 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