# How to Set Up a Custom Error Page

#### Introduction <a href="#introduction" id="introduction"></a>

A custom error page enhances user experience by providing informative messages when an error occurs, such as a **404 Page Not Found** or **500 Internal Server Error**. Instead of displaying generic error messages, you can design your own error page with branding and helpful navigation links. This guide will walk you through setting up custom error pages for your website.

#### Step 1: Determine Which Error Pages You Need <a href="#step-1-determine-which-error-pages-you-need" id="step-1-determine-which-error-pages-you-need"></a>

Common error pages include:

* **404 Not Found** – When a page does not exist.
* **403 Forbidden** – When access is denied.
* **500 Internal Server Error** – When the server encounters an issue.
* **503 Service Unavailable** – When the server is temporarily down.

Identify which pages you want to customize before proceeding.

#### Step 2: Create Your Custom Error Page <a href="#step-2-create-your-custom-error-page" id="step-2-create-your-custom-error-page"></a>

1. Open a text editor or an HTML editor (e.g., Notepad++, Visual Studio Code).
2. Create an HTML file with a descriptive message, such as:&#x20;

   ```html
   <!DOCTYPE html>
   <html>
   <head>
       <title>Page Not Found</title>
       <style>
           body { text-align: center; font-family: Arial, sans-serif; }
           h1 { color: red; }
       </style>
   </head>
   <body>
       <h1>Oops! Page Not Found (404)</h1>
       <p>The page you are looking for might have been removed or is temporarily unavailable.</p>
       <a href="/">Return to Homepage</a>
   </body>
   </html>
   ```

   HTMLCOPY
3. Save the file as `404.html`, `403.html`, or the corresponding error name.

#### Step 3: Upload Your Error Page to the Server <a href="#step-3-upload-your-error-page-to-the-server" id="step-3-upload-your-error-page-to-the-server"></a>

1. Open **File Manager** in cPanel or connect via **FTP**.
2. Navigate to the `public_html` directory.
3. Upload the custom error page files (e.g., `404.html`).

#### Step 4: Configure the `.htaccess`File (For ApacheServers) <a href="#step-4-configure-the-htaccess-file-for-apache-servers" id="step-4-configure-the-htaccess-file-for-apache-servers"></a>

1. Locate the `.htaccess` file in `public_html` (create one if it doesn’t exist).
2. Open it with a text editor and add the following lines:&#x20;

   ```apache
   ErrorDocument 404 /404.html
   ErrorDocument 403 /403.html
   ErrorDocument 500 /500.html
   ```

   ApacheCOPY
3. Save and upload the updated `.htaccess` file.

#### Step 5: Configure Custom Error Pages in cPanel (Alternative Method) <a href="#step-5-configure-custom-error-pages-in-cpanel-alternative-method" id="step-5-configure-custom-error-pages-in-cpanel-alternative-method"></a>

1. Log into **cPanel**.
2. Navigate to **Advanced > Error Pages**.
3. Select the domain for which you want to set up error pages.
4. Click on the error code (e.g., `404`), then enter or paste your custom HTML content.
5. Click **Save**.

#### Step 6: Test Your Custom Error Pages <a href="#step-6-test-your-custom-error-pages" id="step-6-test-your-custom-error-pages"></a>

1. Open a browser and type a non-existent URL (e.g., `yourdomain.com/nonexistentpage`).
2. If configured correctly, your custom 404 error page should appear.
3. Repeat the test for other error pages.

#### Conclusion <a href="#conclusion" id="conclusion"></a>

Custom error pages improve user experience by offering helpful guidance when an error occurs. Whether using `.htaccess` or cPanel’s built-in options, setting up branded and user-friendly error pages helps maintain engagement and professionalism on your website.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://learn.sitecove.com/how-to-guides/web-hosting/website-setup-and-management/how-to-set-up-a-custom-error-page.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
