How to customize the Page Not Found (404) page
Platform Notice: Data Center - This article applies to Atlassian products on the Data Center platform.
Note that this knowledge base article was created for the Data Center version of the product. Data Center knowledge base articles for non-Data Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
Learn to customize the 404 error page served by Confluence, in order to better fit the design of your site.
The content on this page includes steps to customize or extend Atlassian software (adding/changing CSS rules, HTML, JavaScript, etc.). Per the Atlassian Support Offerings, support does not include customizations made to Atlassian products. Be aware that this material is provided for your information only and using it is done so at your risk.
If you have any questions about this or any customization, please ask the Atlassian Community or consider working with an Atlassian Solution Partner.
Solution
Confluence 9.x and later
404.vm file has been replaced with a Soy file after Confluence 9.x. Details on the replaced Velocity files, please see Deprecated code paths removed in 9.0.
- Shut down your Confluence server.
- In the Confluence installation directory, find the jar file confluence/WEB-INF/atlassian-bundled-plugins/com.atlassian.confluence.plugins.confluence-frontend-X.Y.Z.jar where X.Y.Z is the confluence-frontend version.
- Follow the app modification steps mentioned in How to edit bundled or system plugins and modify the
/includes/soy/404.soy
file.- The file contains a mixture of HTML and Soy template syntax. See Google Closure docs for syntax details.
- Make sure to jar the file back when you’re done.
- Start Confluence and test your changes on a staging environment before applying them to a live site.
Confluence 8.x and earlier
Modify '404.vm' or '404.soy'
Find the file 404.vm
that's located in <CONFLUENCE-INSTALLATION-PATH>/confluence
directory. (see Velocity Template Overview for further information about Velocity template language)
Create a Custom .jsp and Modify 'web.xml'
Find the file web.xml
that's located in <CONFLUENCE-INSTALLATION-PATH>/confluence/WEB-INF
directory. Edit the file and find the following line:
<error-page>
<error-code>404</error-code>
<location>/fourohfour.action</location>
</error-page>
Replace the fourohfour.action
with the new custom .jsp page that you created. The default path is <CONFLUENCE-INSTALLATION-PATH>/confluence/
.