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 Mar 12, 2019 in Confluence

Confluence Admin Certification now $150 for Community Members

More and more people are building their careers with Atlassian, and we want you to be at the front of this wave! Important Dates Start the Certification Prep Course by 2 April 2019 Take your e...

299 views 2 13
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