/
How to change URLs embedded in a HTML macro through database
How to change URLs embedded in a HTML macro through database
This article explains step by step instructions on identifying and changing the URLs embedded in Confluence through database.
Instructions
- Create a database backup before changing anything.
- Additionally, any database modifications must be done while Confluence is shut down and not running.
Search for URLs in the Confluence database:
- Stop Confluence following your standard procedure.
Run a SQL statement to update the body content. An example is shown below:
SQL query to identify the embedded URL'sselect c.CONTENTTYPE,c.TITLE, s.SPACENAME, s.SPACEKEY, s.SPACETYPE, s.SPACESTATUS from content c join spaces s on c.SPACEID=s.SPACEID where CONTENTID in (select CONTENTID from bodycontent where BODY like '%<INSERT_KEYWORD_HERE>%')
Replace the <INSERT_KEYWORD_HERE> with your keyword. The '% ' symbol represents a wildcard search.
The SQL results return the CONTENTTYPE,TITLE with other space details including the SPACESTATUS (either CURRENT or ARCHIVED).
Sample query :
Exampleselect c.CONTENTTYPE,c.TITLE, s.SPACENAME, s.SPACEKEY, s.SPACETYPE, s.SPACESTATUS from CONTENT c join SPACES s on c.SPACEID=s.SPACEID where CONTENTID in (select CONTENTID from BODYCONTENT where BODY like '%https://www.w3schools.com/html/html_examples.asp%')
Output:
Change URLs in the Confluence database:
Run the query to change the URL links within the Confluence pages.
update BODYCONTENT set body = replace(body, '<INSERT_OLDURL_HERE>', '<INSERT_newURL_HERE>') where body like '%<INSERT_OLDURL_HERE>%';
Sample query :
Exampleupdate BODYCONTENT set body = replace(body, 'http://help.websiteos.com/websiteos/example_of_a_simple_html_page.htm', 'https://www.w3schools.com/html/html_examples.asp') where body like '%http://help.websiteos.com/websiteos/example_of_a_simple_html_page.htm%';
- Start Confluence following your standard procedure.
- Validate the change of the URL links within the Confluence pages.
, multiple selections available,
Related content
How to use URLs in macros
How to use URLs in macros
More like this
Convert native HTML macros to HTML-bobswift macros
Convert native HTML macros to HTML-bobswift macros
More like this
In-page hyperlinks
In-page hyperlinks
More like this
Create a profile with a URL
Create a profile with a URL
More like this
XSLT macro - Cloud
XSLT macro - Cloud
More like this
XSLT macro
XSLT macro
More like this