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

Topic summary

A Shopify store has over 100 404 errors for URLs with the structure /cdn/shop/files/ that contain %7Bwidth%7B strings, making standard redirects impossible.

Current situation:

  • Shopify support recommended using robots.txt to disallow these URLs
  • The user has added code to their robots.txt.liquid template but encounters an {%- endif -%} error
  • They specifically need guidance on proper robots.txt.liquid syntax for disallowing these URLs

Response received:
A PageFly representative suggested investigating the root cause (missing files, dynamic URLs from apps) and creating a custom 404 page, but this didn’t address the specific robots.txt implementation question.

Status: The technical question about correct robots.txt.liquid syntax remains unanswered. The user is seeking sample code or specific instructions for properly formatting disallow rules in Shopify’s robots.txt.liquid template.

Summarized with AI on November 9. AI used: claude-sonnet-4-5-20250929.

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