Fixing confluence attachments URL

Vadim Shtukan March 10, 2017

Hello. Recently i've moved confluence to another physical server. After that old attachements to pages no longer accessible because they are still have old server URL in link.

Can anybody suggest how-to fix it?

2 answers

1 accepted

1 vote
Answer accepted
Niclas Sandstroem
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 11, 2017

Hi Vadim,

You should be able to bulk update this globally on the instance but keep in mind this method should be done with caution and I recommend a lot of select statements first to pinpoint the best approach to change URLs.

// Ex, https://oldBaseUrl and https://newBaseUrl
UPDATE BODYCONTENT 
 SET BODY = REPLACE(BODY,'<old_string>','<new_string>');

This is the underlying issue I think you run into https://confluence.atlassian.com/confkb/some-attachments-or-links-are-no-longer-accessible-after-server-migration-214862724.html . I recommend installing Source Editor where you can copy a page and try the approach with search and replace in a controlled manner.

Vadim Shtukan March 12, 2017

Thanks you very much. Thats exactly what i needed.

Niclas Sandstroem
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 12, 2017

No problems good luck! smile

1 vote
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 10, 2017

How are the attachements "no longer accessible" - do you mean via page -> attachments?  Do they show up there, but give an error when clicked?  What is the error?

Can you check that

  • Your base url is correct in admin -> general config
  • Your directory is correct in the confluence home / confluence.cfg.xml
Vadim Shtukan March 10, 2017

Thanks for the answer. Here is screenshot

Screenshot_2.png

If i click on that attachement it points to old URL, what used before migration.

image2017-3-10 14:29:19.png

And yes, base url is correct and attachments dir path correct also.

<property name="attachments.dir">${confluenceHome}/attachments</property>
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 10, 2017

Ah, ok, that looks like someone has embedded the link as a link, instead of using Confluence's internal links.  I think

Before I go any further down that path, I'd like to confirm it - could you edit the page, and look at the exact type of link there is there.  Is it a full web link, or an "embed attachment" macro?  (Don't need to save the page).  If you're not sure, then can you have a look in "view source" and see how the link is shown in there?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events