All Collections
Look and Feel
Managing Pages (X-Cart 5.4.x and earlier)
Changing 404 "Page Not Found" (X-Cart 5.4.x and earlier)
Changing 404 "Page Not Found" (X-Cart 5.4.x and earlier)

Learn how to customize the 404 page.

Seller Labs avatar
Written by Seller Labs
Updated over a week ago

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:

Editing the 404 Page via Theme Tweaker

By using the built-in Theme Tweaker add-on 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 administrator to the store Admin area and open the customer storefront. Use the 'Your store is' link at the top of any page for quick access.

  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, see the bottom of the screen for your Theme Tweaker tools.

  4. To edit the text of the error message, open the Labels Editor tool, enable the "Highlight labels" toggle, 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" toggle, locate the relevant .twig file and add your changes to the template.
    See Template Editor for details.


    Once finished, be sure to save your changes.

Editing the 404 Page via Server Facilities

It is possible to change the default 404 page to a completely custom one as an alternative.

For an Apache server:

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

  2. Locate/create a .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_04.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 see the custom 404 page specified in the .htaccess file.

For an 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. Then, you should get your custom 404 page.

Related pages:

Did this answer your question?