URL Rewrites Miss JSON Images? Escape Forms Are the Reason
Β· 8 min read
During the final verification pass of a CDN migration for a client site, the homepage slider's large images and a 47MB background video were still serving from the origin domain, hogging a 5Mbps shared uplink β while the noscript fallback inside the very same element already pointed at the CDN domain. Half the element migrated, half didn't.
TL;DRβ
- URLs don't only live in
src="...". Slider plugins store image paths inside inline JSON ("src":"..."β colon form), often further escaped intohttps:\/\/byte streams. An attribute-grammar rewrite surface (src=/srcset=/href=with a whitespace-required prefix) misses all of these, and a plainstr_replacemisses the escaped forms too. - Close it with a storage-side three-form replace: inspect the stored form first, then replace plain, single-escaped, and double-escaped variants separately. We closed 204 occurrences across the three
slides/slides7tables of Slider Revolution. PHP serialized fields must go through the serialization engine; JSON fields can be replaced byte-for-byte. - Then run a two-hop save fixpoint: two consecutive editor saves that leave the stored byte stream unchanged prove the save path writes back no old domain.