Static WordPress Community

Static HTML Output and Shortpixel AI: Issue with url replacement

Hi @leonstafford,

me again :wink:

As you may remember we have WP in a Docker container (AWS ECS) and export the site to a S3 bucket (but not via your s3 integration but via PHP API).

Now I have the following problem:

Shortpixel AI changes the url of the images to e.g. https://images-cms.compeon.de/spai/w_1920+q_glossy+ret_img/https://www.compeon.de/wp-content/uploads/2017/12/Finanzpartner.jpg), where images-cms.compeon is our own alias which redirects the request to the shortpixel service.

When doing the export, Static HTML Output doesn’t replace these urls. I tried it with str_replace after the export, but due to some strange behaviour of shortpixel (it replaces the urls with base64 svg before rendering the image), it doesn’t get replaced by the url of the static page.

After contacting shortpixel support they implemented a hook to change the url for the images.

BUT: When I do that, of course the images are not being found because they don’t exist yet on the live site.

Is there any http header that your crawler sends when crawling so I can only run that hook of shortpixel when your crawler crawls the site?

Or do you have any other solution for this problem?

Thanks,

Robert