Shopify /cdn/shop images showing up as 404 | Robots.txt query

Shopify /cdn/shop images showing up as 404 | Robots.txt query

Cormac_Kerrigan
Shopify Partner
30 1 2

Hi All,

We are doing SEO work on a Shopify store and have over 100 404 pages that all have the following url structure: /cdn/shop/files/ 

We are unable to place simple URL redirects here as we believe the URL has a %7Bwidth% string in it. Shopify have advised us to use a robots.txt file and add in all affected URLs as per this link: https://shopify.dev/docs/themes/seo/robots-txt I've added in a robots.txt.liquid template, but can anyone advise how I would go about adding these URLs to be robots.txt file? Does anyone have any sample robots.txt code they could supply? Here is one of the affected URLs for reference:

 https://femfuelz.com/cdn/shop/files/Untitled_design-207_%7Bwidth%7Dx.png?v=1692782218

Replies 2 (2)

PageFly-Theodor
Shopify Partner
691 86 102

Hi @Cormac_Kerrigan ,
This is Theodore from PageFly - Shopify Page Builder App.

To tackle the 404 errors and robots.txt configuration in your Shopify store:

1. Identify the Cause of 404s:

  • Check if files exist for the URLs (/cdn/shop/files/). If not, remove them from sitemap/robots.txt.
  • Investigate dynamic URLs (from apps) to prevent indexing or redirect them.
  • Use Shopify's bulk editor to remove old content or set it to "unpublished."

2. Create a Custom 404 Error Page (Optional):

  • Improve user experience by offering helpful information or suggesting relevant content.
  • Create a 404.liquid template in your theme and customize its content.

 


Best regards,
Theodore | PageFly

Please let me know if it works by giving it a Like or marking it as a solution!


PageFly - #1 Page Builder for Shopify merchants.


All features are available from Free plan. Live Chat Support is available 24/7.

Cormac_Kerrigan
Shopify Partner
30 1 2

Hi, thanks but that's not the question I asked. 

How do I edit the robots.txt.liquid file to disallow these specific URLs? 

 

I have tried adding the below code and it gives me an error: 

 

{%- if group.user_agent.value == ‘*’ -%}

{{ ‘Disallow: [/cdn/shop/files/Untitled_design-236_%7Bwidth%7Dx.png?v=1705503886]‘ }}

{%- endif -%}