Skip to content

How to Fix Images After Bookstack Domain Migration


This is a very specific case, but one I encountered recently when converting Bookstack from a dedicated VM to a container. In doing this, I also changed the location of the images from being hosted locally to being hosted on AWS S3. Because the Bookstack data lives in the Managed MySQL database hosted on DigitalOcean, it wasn't affected, but the image locations did not automatically update.

The article this query came from mentions that there's an issue requesting an admin feature to help with this on BookStack's GitHub page.

The following is a query that can be run in order to automatically update the image location domain.

SQL Query

UPDATE pages
SET     html =
                html, 'http://YOUR.OLD.URL', 'https://YOUR.NEW.URL'),
                'https://YOUR.OLD.URL', 'YOUR.NEW.URL');
UPDATE images
SET     url =
                url, 'http://YOUR.OLD.URL', 'https://YOUR.NEW.URL'),
                'https://YOUR.OLD.URL', 'YOUR.NEW.URL');