MG 1.1 Import from Photopost - redirect embedded image URLs?


Well-known member
I've just completed a migration from vB 3.8.x + Photopost to XF + XFMG and was wondering if there is an automated mechanism for redirecting embedded image URLs that were embedded from the gallery in forum posts on the old site.

For example, we have plenty of posts that were imported where there was a photo uploaded to Photopost and then displayed in a forum post using bbcode, so you end up with code like this:


Now of course, this URL is no longer valid after removing Photopost, so I'd like to put in some URL rewrites to redirect that to an actual valid XFMG URL.

Is there something built in to XFMG which will do this automatically?

If not, is the original file name indexed in the database anywhere so I can do a lookup and redirect to the new location?


Well-known member
I haven't tried it yet, but I'm thinking if I find the filename from the xf_attachment_data table, join it with the xf_attachment table on data_id to find the attachment_id, then join that with the xengallery_media table on attachment_id and specify the category_id from the URL in a where clause to validate ... that should give me what I need?

Chris D

XenForo developer
Staff member
There's nothing built in to achieve this.

The common solution is to either leave the original files in place or use an add on which imports these as attachments.


Well-known member
Thanks Chris - I think I'm going to just sync the old gallery directory structure to a static S3 website and do a global find/replace on posts to swap to the new URL - will be easier than mucking around with database joins I think.


Active member
I may as well ask here specifically as well as I have the same problem today, although I'm running apache as the webserver.

If there isn't an easy way to redirect the photopost jpg files to the imported xenforo /data/xenforo/ jpg files, I can archive the photopost /gallery/data directory. However, it appears in order to have XFMG use the /gallery route filter I have to move the gallery/data directory to archivegallery/data or else the XFMG /gallery route filter doesn't work.

Can someone help me with a good modrewrite rule to redirect
the old photopost image URLs
and so on...

without messing up the xenforo
route filter that XFMG will now be under itself.