slscart logo

Create a Custom Error Page for your Store

What are error (404) pages?

A quick lesson on error (404) pages: When a web page is clicked on, the server sends back a status code to the browser along with a web page. If the web page was found, the status code is 200. If the web page is not found, the status code is 404. The server handles the missing web page by sending its Not Found page to the browser.

A custom error page can be specified rather than using the server's default error page. Both require editing the .htaccess file in the store's home (root) directory.

There are two ways to create a custom (user-friendly) error page in slscart: one is to use the default error page that comes with slscart OR create your own custom error page.

How to Enable slscart Default Error Page

1. in the .htaccess file add, or change, a path to the error.php file in the home (root) directory of slscart

ErrorDocument 404 /error.php

This line may already exist in the .htaccess file with a # in front of it. The # means ignore this line so just delete the # and it should work.

Test it out by entering a web page that does not exist in your store. For example, if your store's domain is www.mydomain.com then try this: www.mydomain.com/nosuchpage.html
An error page will show up using your template.

If your store is installed in a subdirectory, for example mystore, like www.mydomain.com/mystore, then the htaccess would be:

ErrorDocument 404 /mystore/error.php

and the error test page would be: www.mydomain.com/mystore/nosuchpage.html

What shows up on the sls error page

How to Create a Custom Error Page

1. In storeadmin > Web Site > Pages, create custom 404 page as a separate page. Make the page name: custom404

2. Set 'Show Link' to 'no'

3. Add whatever verbage you wish on Content:

4. Save your work

5. in the .htaccess file add, or change, a path to the 404 page created in storeadmin

ErrorDocument 404 /pages/custom404.php

How to Test

Type in a url to your website store with an invalid webpage. The browser should take you to your custom error page.

***