phpBB: Serve static files from a CDN

Having recently spent the best part of a day modifying the phpBB codebase (3.0.7) to allow me to serve static files via a CDN I can say that I am greatly looking forward to hooks in 3.1.

To save you all a little effort I’m gonna share the method I used below; I’m not going to go into great detail about template and theme issues, as those are a fairly straightforward matter of swaping the old local URL’s in your template/theme for the new public CDN URL’s and clearing the cache. But rather I will explain how to modify the core files to serve smilies, forum ranks, forum images and your imageset which is a tad more involved.

First of all BACKUP ANY FILES YOU’RE GOING TO MODIFY. Seriously. Do it right now.

To move forum images:

Find the below in includes/functions_display.php:

This appears twice in the file, edit both instances as follows:

This is the title

To move smilies:

Find the below in includes/functions_content.php:

This is the title

Edit it into the form shown below:

Edit it into the form shown below:

To move forum ranks:

Find the below in includes/functions_display.php:

Edit it into the form shown below:

To move the imageset:

Find the below in includes/session.php:

Edit it into the form shown below:

That’s it. Reupload and see you work in action. You shouldn’t have to edit imageset.cfg at all if the edits have been performed correctly, as it will still grab the filenames as before but now it will prepend the URL of your CDN and not the template URL that was previously assigned by the above files.

Good luck, and let me know if you have any questions.