custom login Developer Jahia 7.3 Jahia 8 Legacy

Override default Jahia login page

Question

How to override default Jahia login page

Answer

There are a couple of ways in which this can be achieved:

1. You can override the error_401.jsp, which is the JSP being served by Jahia when a 401 error is raised in live
You have 2 possibilities for overriding this JSP, you can create your own error_401.jsp (you have to use this exact name) and :

  • put this JSP in your Tomcat directly, in the folder "/webapps/ROOT/errors" (there should be already the default error_401.jsp file in there, you can replace it) or
  • put this JSP in your TemplateSet, in this folder : /your-template-set-module/src/main/resources/errors
  • use the community module (not supported by Jahia) Customize error pages

2. You can define a Java class implementing LoginUrlProvider and defining the URL you want to redirect to for login page.
We have an example module showing how to do this on Github : https://github.com/Jahia/loginlogout-url-provider