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:
. 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.
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)
On that page, see the bottom of the screen for your Theme Tweaker tools.
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.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:
Create your custom 404 page in HTML (e.g. custom_404.html).
Locate/create a .htaccess file in the root of your X-Cart store's directory hierarchy on the server.
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.
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:
Create your custom 404 page in HTML (e.g. custom_404.html).
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;
}
}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: