The Challenge
Following a platform migration from WordPress to Magento, one client's Google Images organic sessions dropped by 62% within four weeks. The image traffic had previously been a meaningful acquisition channel — product photography in a competitive visual category (home décor) was consistently surfacing in Google Images for purchase-intent queries. Post-migration, that channel went effectively silent.
The diagnosis took less than 48 hours but the fix required weeks of systematic execution. Image traffic loss post-migration almost always traces to one of three causes: broken image URLs (the images moved but 301s weren't set up for the image paths), alt text being stripped or genericised during the platform transfer, or image filenames losing their descriptive content and reverting to CMS-generated identifiers.
This case had all three, at scale — the product catalogue had 80,000+ images.
Diagnosing the Breakage
I pulled a sample of the top-performing image URLs from Google Analytics (pre-migration data) and checked their status post-migration. Result: 78% were 404ing. The migration had moved image files to a new CDN path structure, but no redirect rules had been set for image files — the redirect map work had focused exclusively on HTML pages, as is typical, missing the image layer entirely.
Beyond the 404 issue, the Magento platform had renamed images on import. WordPress stores allowed custom filenames; the Magento import tool had overwritten them with SKU-based identifiers (e.g. MG001234-001.jpg). These filenames carried zero semantic value for Google's image understanding system.
Finally, alt text. The migration had pulled alt text from the WordPress database where it existed — but for a significant portion of the catalogue (products added by non-SEO team members), alt text had never been set or was a copy of the product title without modification.
The Automation Solution
Image redirect layer
I built a mapping file in Python by cross-referencing the Wayback Machine's crawl data (which had indexed image URLs pre-migration) against the new CDN structure. For products with a consistent SKU-to-filename mapping, the redirects could be pattern-matched. For irregular cases, the script flagged them for manual review. The resulting Apache rewrite rules brought the 404 rate for image files down from 78% to under 4%.
Automated filename and alt text generation
The core deliverable was a Google Sheets formula system — essentially a spreadsheet-based factory for generating SEO-optimised image filenames and alt text from product attributes. Input columns: product name, brand, primary colour, material, product category. Output columns: SEO filename (slug format, hyphenated, 6–8 words), alt text (natural language description following a brand-defined template), and a "ready for upload" flag.
The formula templates used a combination of CONCATENATE, LOWER, SUBSTITUTE, and TRIM functions — no macros or scripts, so the non-technical merchandising team could run it themselves for new products without engineering support. For the 80,000+ existing products, I ran a Python version of the same logic against the product database export to generate the output in bulk.
Implementation and validation
Images were renamed in batches by CDN folder (category-level groupings), with a post-rename crawl to confirm the new filenames were being indexed. Alt text was imported via Magento's product import CSV — a phased rollout starting with the top 500 revenue-generating products, then expanding to the full catalogue.
The Outcome
Google Images organic sessions recovered to pre-migration levels within 3–5 months, confirmed via GSC's image search performance filter. The automation system became a standard part of the agency's migration runbook — every subsequent migration included image SEO as a tracked workstream, not an afterthought. The alt text generation template was later adapted for a second client in a different category with minimal modification.
Tools & Stack
Google Analytics · Google Search Console (Image Search filter) · Screaming Frog (image crawl) · Python (redirect mapping, bulk alt text generation) · Google Sheets (formula templates) · Apache .htaccess (image redirect rules) · Magento product import CSV