Main issue: Ahrefs reports 404 errors for all product pages. The crawled URLs appear to be built from the H1/product title and include spaces encoded as %20, which don’t match the actual Shopify product URLs.
Likely cause: Theme or link generation uses the product title in URLs instead of the proper handle/URL, producing malformed paths.
Recommended actions:
Ensure product URLs follow /products/{product-handle} (handle = simplified, hyphenated version of the title).
Check theme templates (e.g., product.liquid, main-product.liquid) and use {{ product.url }} or {{ product.handle }}, not {{ product.title }}.
After fixing, rely on Shopify’s auto-generated sitemap (domain/sitemap.xml) and have Ahrefs recrawl.
Evidence: Ahrefs screenshot shows URLs containing %20 and full titles, indicating incorrect URL construction.
Status: OP will investigate based on advice; no confirmed resolution yet (thread open).
Summarized with AI on December 14.
AI used: gpt-5.
When checking Ahrefs, For some reason, all of our product pages are showing a 404 error. It looks like the errored URL is using the H1 title. I am not sure what this issue is here and where I can find the issue to fix (in which code file and what to look for)
Please help if you can. I am sure it is a simple fix.
It looks like there is space in product url (%20" - representing spaces). This structure is causing the 404 errors, as it doesn’t match the actual URLs on your Shopify store.
-Verify Product URL Structure: Check the product URLs in Shopify. They should follow a structure like https://yourdomain.com/products/product-handle, where “product-handle” is a simplified version of the product title (usually lowercase, with hyphens instead of spaces).
-The URLs in the Ahrefs screenshot show a format like https://thecbdhub.co.uk/products/Dr%2… This structure seems incorrect, as it’s including spaces (%20) and full titles instead of simplified handles.
-Review your theme’s product template files (e.g., product.liquid, main-product.liquid) to ensure the URL generation is using {{ product.url }} or {{ product.handle }}, not {{ product.title }}.
Once you verify that the URLs on your Shopify site are correct, update your sitemap (Shopify generates it automatically at https://yourdomain.com/sitemap.xml).
I hope this helps! If it does, please like it and mark it as a solution!
If you need further assistance, feel free to reach out!