Confluence Gotchya: Resolving Images After Site Move

As any developer knows (or should know), documentation is king. Not only commenting your code, but also keeping other documentation on your projects for you to refer to when needed. As some of the freelance work I’ve done has been in the Drupal sphere, I needed to set up a dev environment on my local machine. Being a Windows machine, creating a WAMP server seemed the option to go for. Then I figured – I already have all the requirements – why not host my own Confluence installation locally on this server as well?!

So away I went, documenting my work in Confluence, creating user guides etc etc. The only issue here, was that the server, and therefore Confluence, was only available to me from within my internal network. When required to work on site with clients, I lost all access to Confluence unless I brought my laptop with me (Note: that this was not due to a WAMP limitaion, rather my lack of outward facing server infrastructure at the time).

I then decided to create a LAMP server, and have this available to me externally. After creating the Linux machine and setting up LAMP, I exported Confluence from the WAMP server to the LAMP server. This was quite painless, aside from one nagging problem – the images I had inserted into my documentation were referring to the old installation details, and not the new one.

Originally, my local Confluence was located at http://wiki.fakesite.com:8090. I’d moved the new Confluence instance to https://wiki.fakesite.com (port 443), and used Apache reverse proxies to direct the traffic to my Confluence site. All links within confluence now pointed to https://wiki.fakesite.com, but all the images remained at http://wiki.fakesite.com:8090, which did not exist anymore. What resulted was a wiki full of broken images.

Posting the question on was very helpful, and I was informed that these image URLs were being stored and read form the database. The MySQL search

select * from BODYCONTENT where body like '%http://wiki.fakesite.com:8090%';

displayed all of the images that contained this old data. Then a simple search and replace query of

UPDATE BODYCONTENT
   SET BODY = REPLACE(BODY,'http://wiki.fakesite.com:8090','https://wiki.fakesite.com');

replaced these outdated values. Running the first search query again yielded no results. And of course after checking my Confluence installation again – my images were back!

I hope this helps out someone with a similar situation!

This entry was posted in Confluence and tagged , . Bookmark the permalink.

Add a comment...

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s