How do I replace all 'hard' links to my old base URL

Still need help?

The Atlassian Community is here for you.

Ask the community


When changing the Base URL, either due to a URL change or from an export/import (e.g. Cloud to Server or Server to Server) absolute links to the old Base URL need to be changed.

Example Server to Server

Old Base URL
New Base URL

Example Cloud to Server (this requires extra steps)

Old Base URL
New Base URL

Please note that Cloud to Server Base URL change requires extra steps due to these known issues


Error rendering macro 'excerpt-include' : No link could be created for '_Note about database ope'.

The steps below will change the base URL on the current page, but not in previous versions of the page.

Export and Import Option

Either create a full site export, or full text database dump and perform a find/replace or sed to change the old Base URL to the new Base URL.

1. Generate export file

Full site export
  1. Go to > General Configuration > Backup & Restore
  2. Check Back up attachments
  3. Click Back Up
  4. Find the xmlexport file (usually) in <confluence-home>/temp
  5. Extract the entities.xml file from the xmlexport file
  6. Shut down Confluence
Database export

Use a native database tool to export all the data. This requires Confluence to be shut down.

  • For MySQL use mysqldump
  • For PostgreSQL use pg_dump

2. Replace Old Base URL to New Base URL

For Cloud exports only ...

Cloud exports will use the entities.xml file for the backup zip

  1. For CONFSERVER-54759 - Getting issue details... STATUS
    Replace all content URLs to Confluence Server format with this command (using the example URLs above)

    sed -r -e 's/mycompany\.atlassian\.net\/wiki\/spaces\/[A-Z0-9]+\/pages\/([0-9]+)\/[A-Za-z0-9+.]+/\/pages\/viewpage.action?pageId=\1/g' entities.xml
  2. For CONFSERVER-45919 - Getting issue details... STATUS
    Replace incorrect Base URL entry from N/A

    sed -r -e 's/<server\.base\.url>N\/A</server\.base\.url>/<server.base.url></server.base.url>/g' entities.xml

This example uses the site export file entities.xml, if doing a database export replace this file with export.sql)

sed -r -e 's/mycompany\.com\/confluence/' entities.xml

3. Reimport

Full site export

Using this option will require extra steps to re-load all the Add-ons from

  1. Re-zip up the xmlexport file, taking care to place the files in the same location
  2. Go to > General Configuration > Backup & Restore
  3. Click Choose file and select the new xmlbackup xip file
  4. Click Upload and Restore
Database import

Use the database tools to re-import the data.

WebDAV option

Use the WebDAV plugin and mount the WebDAV location locally, then run a script that uses sed to replace all of the Old Base URLs. This option creates a new page version for all pages that are changed (this includes any page versions that are crawled and edited).

Confluence Source Editor option

You can use the Confluence Source Editor app to modify content on a page-by-page basis.

  1. Install the Confluence Source Editor app.
  2. Open the editor on an affected page.
  3. Click the <> button on the top right of the editor.
  4. Replace any occurrences of the old base URL with the new base URL.
  5. Save the page.

This technique has the benefit of being less risky than doing direct data manipulation and it's easier than manually linking the attachment through the editor interface. 

Last modified on May 1, 2019

Was this helpful?

Provide feedback about this article
Powered by Confluence and Scroll Viewport.