How to replace text on confluence

Hi All

In my confluence 4.3, i have lot of users hardcoding links to the attachments (instead of using the attachment macro)  that are uploaded on confluence.

The problem with this is that if i change my confluence URL then all these hardcoded links will break.

What are my options to not let the links break?

  • Can i do a find and replace for all such hardcoded links to attachments.
  • Do i have to update hundreds to pages manually?
  • Can i do it via database? any plugins?



3 answers

1 vote

Hi Aich, 

I found this answer that seems very similar with this question. I think worth it to try. However, it is a third part plugin, so you need to install it. The plugin can be found in this link.

After you have installed the plugin, you can try this command line:

confluence --action runFromContentList --runFromPageList "\"\"" --space NAME-OF-A-SPACE --common "--action modifyPage --id @pageId@ --findReplace \"\" --special \" #\" "


I hope it helps.


Renato Rudnicki


Another option for changing the base URL is to do the following:

  1. Use your database back-up tools (e.g. if you use MySQL, then mysqldump) to create a dump of your Confluence database. This creates a plain text file containing the SQL to rebuild the database
  2. Use the sed command on this file to change your URLs from the old to the new. For example:

  3. Restore your database file

As with anything involving the database, make sure you perform a back-up that you will leave unchanged that you can restore if something goes wrong. Also, first try this out within a test environment.

From my experience though - this procedure has worked well for me and avoided having to install add-ons.

An option I've used for this kind of thing is to write an external script (I use Python and XML/RPC) that reads pages, finds and changes the text, and saves the pages back.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published 6 hours ago in Confluence Cloud

Happy holidays from our team to yours!

Hi Community!  2018 was filled with changes for our team, both big and small, and we've taken a lot of time to both celebrate our wins and recognize areas of improvement. One thing that we're a...

81 views 0 9
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you