Why use the boring default 404 ‘Page not found’ page when you can change it to something more personal and inspiring?

The default page with the 404 ‘Page not found’ error in X-Cart looks as follows:

By using the built-in Webmaster Mode facilities, you can change the page text and layout, as well as add images, gifs and videos to your liking.

To edit the 404 page:

1. Log in as an admin to the store Admin area and open the customer storefront using the ‘View storefront’ button located at the top. This button can be accessed from any page in the Admin area.

2. In the storefront area of your X-Cart store, open any store page URL that results in displaying the 404 ‘Page not found error’ message (e.g. https://your_xcart_store_url/cart.php?target=blah-blah-blah)

3. On that page, click on the ‘Gear’ icon in the bottom left-hand corner to open the Webmaster mode tools.

4. To edit the text of the error message, open the Labels Editor tool, enable Highlight labels and edit the text as described in our guide.

Once finished, be sure to save your changes.

5. To change the page layout or add an image/gif/video open the Template Editor tool, enable the Pick templates from page option, locate the relevant .twig file as described in How to Use Template Editor, and add your changes to the template.

Once finished, be sure to save your changes.

As an alternative, it is possible to change the default 404 page to a completely custom one.

For an Apache server:

1. Create your custom 404 page in HTML (e.g. custom_404.html).

2. Locate/create an .htaccess file in the root of your X-Cart store's directory hierarchy on the server.

3. Add the following line to your .htaccess file:

ErrorDocument 404 /custom_404.html

where /custom404.html is the full path to the new custom 404 page that you have created.

4. Check your work. Try opening a store page URL that you know does not exist on your store website. You should get your custom 404 page that you have specified in the .htaccess file.

For a Nginx server:

1. Create your custom 404 page in HTML (e.g. custom_404.html).

2. Add a few lines (as provided below) into the server {} section of your nginx configuration file (nginx.conf):

server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;

. . .

error_page 404 /custom_404.html;
location = /custom_404.html {
root /usr/share/nginx/html;
internal;
}
}

3. Check your work. Try opening a store page URL that you know does not exist on your store website. You should get your custom 404 page.

Related pages:

Did this answer your question?