You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@grails.apache.org by ja...@apache.org on 2025/10/24 12:37:31 UTC
(grails-static-website) 01/01: Add custom 404 error page and update htaccess
This is an automated email from the ASF dual-hosted git repository.
jamesfredley pushed a commit to branch custom-404
in repository https://gitbox.apache.org/repos/asf/grails-static-website.git
commit 8c48221bfa32c3448816b1c574604360447525da
Author: James Fredley <ja...@users.noreply.github.com>
AuthorDate: Fri Oct 24 08:37:21 2025 -0400
Add custom 404 error page and update htaccess
Introduced a new 404.html page for handling not found errors and updated HtaccessTask to serve this custom page for 404 errors. This improves user experience by providing a branded error page and clearer guidance when a page is missing.
---
.../groovy/org/grails/gradle/HtaccessTask.groovy | 3 +++
pages/404.html | 28 ++++++++++++++++++++++
2 files changed, 31 insertions(+)
diff --git a/buildSrc/src/main/groovy/org/grails/gradle/HtaccessTask.groovy b/buildSrc/src/main/groovy/org/grails/gradle/HtaccessTask.groovy
index a3a4a483280..9f1682a9bb6 100644
--- a/buildSrc/src/main/groovy/org/grails/gradle/HtaccessTask.groovy
+++ b/buildSrc/src/main/groovy/org/grails/gradle/HtaccessTask.groovy
@@ -40,6 +40,9 @@ class HtaccessTask extends DefaultTask {
]
private static String HT_ACCESS_CONTENT =
+ '# Custom 404 error page\n' +
+ 'ErrorDocument 404 /404.html\n' +
+ '\n' +
'# CSP permissions for grails.apache.org - https://issues.apache.org/jira/browse/INFRA-27297\n' +
'# Ref https://docs.kapa.ai/integrations/understanding-csp-cors\n' +
'SetEnv CSP_PROJECT_DOMAINS "' + DOMAINS.join(' ') + '"'
diff --git a/pages/404.html b/pages/404.html
new file mode 100644
index 00000000000..55677cb2eac
--- /dev/null
+++ b/pages/404.html
@@ -0,0 +1,28 @@
+title: Page Not Found | Grails® Framework
+CSS: /stylesheets/support.css
+---
+<div class='headerbar chalicesbg'>
+ <div class='content'>
+ <h1>404 - Page Not Found</h1>
+ </div>
+</div>
+<div class='content'>
+ <article>
+ <p class="intro_copy">
+ <h2>Oops! The page you're looking for doesn't exist.</h2>
+ <p>The page you are trying to access might have been removed, had its name changed, or is temporarily unavailable.</p>
+
+ <h2>What can you do?</h2>
+ <ul>
+ <li>Check the URL for typing errors</li>
+ <li>Return to the <a href="/">home page</a></li>
+ <li>Visit our <a href="/learning.html">learning resources</a></li>
+ <li>Explore the <a href="/community.html">Grails community</a></li>
+ </ul>
+
+ <h2>Need Help?</h2>
+ <p>If you believe this is an error or need assistance, please reach out to the Grails community through our
+ <a href="/community.html">community channels</a> or check our <a href="/support.html">support options</a>.</p>
+ </article>
+</div>
+