How do I make Liferay 6.1.0 always redirect to a 404 page when a resource isn't found?

后端 未结 1 996
眼角桃花
眼角桃花 2021-01-07 00:27

I have created a simple hook for a Liferay site I have. It contains a 404.jsp that overrides the default Liferay 404. It works fine if I type in a specific page. For example

相关标签:
1条回答
  • 2021-01-07 00:40

    I was still struggling to figure out how to do this until I read the section in the Liferay Developer's Guide about "Overriding a JSP". That told me exactly what I needed to know. Where the 404.jsp file should be stored in my hook, why there was a .portal.jsp file appearing in my liferay installation, etc. One other critical thing that was not mentioned was the addition required to the portal-ext.properties file. I had to add the following:

    # 404 page
    layout.show.http.status=true
    layout.friendly.url.page.not.found=/errors/404.jsp
    

    After a server restart, the 404 page started displaying for all incorrect pages.

    0 讨论(0)
提交回复
热议问题