Custom error page for 404s
You can replace the default 404 error page that Codeberg Pages will show for missing pages with your own version if you prefer. To do so start by writing your own HTML file that you want to serve instead.
After creating the HTML with your custom error message, save it as 404.html in the root of your
repository that you use to serve your Codeberg Page.
From then on, your 404.html file will be served when the error is encountered.
Redirects
Redirects can be created with a _redirects file with the following format:
# Comment
from to [status]
- Lines starting with
#are ignored from- the path to redirect fromto- the path or URL to redirect tostatus- status code to use when redirecting (optional, default 301)
Status codes
200- returns content from specified path (no external URLs) without changing the URL (rewrite)301- Moved Permanently (Permanent redirect)302- Found (Temporary redirect)
Examples
Simple redirect
Redirects a specific path.
/example https://example.com/ 301
/path /other-path 301
SPA (single-page application) rewrite
Redirects all paths to /index.html for single-page apps.
/* /index.html 200
Splats
Redirects every path under /articles to /posts while keeping the path.
/articles/* /posts/:splat 302
Example: /articles/2022/10/12/post-1/ → /posts/2022/10/12/post-1/