Difference between revisions of "X-Cart:404 Error Page"

From X-Cart 4 Classic
Jump to: navigation, search
(Creating Versions of the 404 Error Page for Other Languages)
(Creating Versions of the 404 Error Page for Other Languages)
 
(3 intermediate revisions by 2 users not shown)
Line 13: Line 13:
 
Please note that X-Cart's 404 error page does not work out of the box. To use it in your store, you need to enable it. The procedure is different depending on the web server you are using. Instructions for enabling the 404 page in X-Cart on the most popular web servers are available in the following sections:
 
Please note that X-Cart's 404 error page does not work out of the box. To use it in your store, you need to enable it. The procedure is different depending on the web server you are using. Instructions for enabling the 404 page in X-Cart on the most popular web servers are available in the following sections:
  
* [[#Enabling X-Cart's 404 Error Page on Apache]]
+
* [[#Enabling X-Cart's 404 Error Page on Apache | Enabling X-Cart's 404 Error Page on Apache]]
* [[#Enabling X-Cart's 404 Error Page on IIS]]
+
* [[#Enabling X-Cart's 404 Error Page on IIS | Enabling X-Cart's 404 Error Page on IIS]]
  
X-Cart's 404 error page is easily customizable. To find out how you can change the content of your store's 404 error page, see the section [[#Customizing X-Cart's 404 Error Page]].
+
X-Cart's 404 error page is easily customizable. To find out how you can change the content of your store's 404 error page, see the section [[#Customizing X-Cart's 404 Error Page | Customizing X-Cart's 404 Error Page]].
  
 
The 404 error page included with the X-Cart distribution package is intended for the English language. If you wish to enable the users of your store speaking in languages other than English to read the contents of the 404 error page in their own languages, you must create a version of the
 
The 404 error page included with the X-Cart distribution package is intended for the English language. If you wish to enable the users of your store speaking in languages other than English to read the contents of the 404 error page in their own languages, you must create a version of the
  
provide 404 error pages for languages other than English, you must create them. For instructions, see the section [[#Creating Versions of the 404 Error Page for Other Languages]].
+
provide 404 error pages for languages other than English, you must create them. For instructions, see the section [[#Creating Versions of the 404 Error Page for Other Languages | Creating Versions of the 404 Error Page for Other Languages]].
  
 
==Enabling 404 Error Page on Apache==
 
==Enabling 404 Error Page on Apache==
Line 58: Line 58:
 
==Customizing 404 Error Page==
 
==Customizing 404 Error Page==
  
The content of X-Cart's 404 error page for the English language is defined by the file <u>404_US.html</u> located in the directory <u>/</u>xcart<u>/skin1/404/</u>. You can easily change the look and feel, as well as the textual content of your store's 404 error page by editing this file. The editing can be done in X-Cart's built-in template editor (see the section [[X-Cart:Editing_Skin_Files#Using__Template_Editor | Using Template Editor]]), or in any decent external text editor.
+
The content of X-Cart's 404 error page for the English language is defined by the file <u>404_en.html</u> located in the directory <u><xcart_dir>/skin/common_files/404</u>. You can easily change the look and feel, as well as the textual content of your store's 404 error page by editing this file. The editing can be done in X-Cart's built-in template editor (see the section [[X-Cart:Editing_Skin_Files#Using__Template_Editor | Using Template Editor]]), or in any decent external text editor.
  
 
==Creating Versions of the 404 Error Page for Other Languages==
 
==Creating Versions of the 404 Error Page for Other Languages==
Line 68: Line 68:
 
'''To create a version of the 404 error page''' for a language other than English, do the following:
 
'''To create a version of the 404 error page''' for a language other than English, do the following:
  
# Save the file <u>404_US.html</u> from the directory <u>/</u>xcart<u>/skin1/404</u> as <u>404_XX.html</u>, where <u>XX</u> is an ISO 3166-1 alpha-2 code of the country corresponding to the desired language. You can accomplish this using the '<u>Browse templates</u>' section of your store's Admin area (<u>Administration menu->Edit templates</u>):
+
# Save the file <u>404_en.html</u> from the directory <u><xcart_dir>/skin/common_files/404</u> as <u>404_xx.html</u>, where <u>xx</u> is an ISO 639-1 alpha-2 code of the desired language. You can accomplish this using the '<u>Browse templates</u>' section of your store's Admin area (<u>Administration menu->Edit templates</u>):
#* Browse to the directory <u>/xcart/skin1/404</u>.
+
#* Browse to the directory <u><xcart_dir>/skin/common_files/404</u>.
#* Select the radio button next to the filename <u>404_US.html</u>.
+
#* Select the radio button next to the filename <u>404_en.html</u>.
#* In the section '<u>Copy selected file to...</u>', enter the filename for the new language version of the 404 error page. For example, if you wish to create a version of the 404 error page in German, you must use the filename <u>404_DE.html</u>.
+
#* In the section '<u>Copy selected file to...</u>', enter the filename for the new language version of the 404 error page. For example, if you wish to create a version of the 404 error page in German, you must use the filename <u>404_de.html</u>.
 
#* Click the '''Copy''' button.
 
#* Click the '''Copy''' button.
# Open the file <u>404_XX.html</u> that has been created in a text editor. For example, you can use X-Cart's built-in template editor (See [[X-Cart:Editing_Skin_Files#Using__Template_Editor | Using Template Editor]]).
+
# Open the file <u>404_xx.html</u> that has been created in a text editor. For example, you can use X-Cart's built-in template editor (See [[X-Cart:Editing_Skin_Files#Using__Template_Editor | Using Template Editor]]).
# Edit the textual content of the <u>404_XX.html</u> file translating it from English into the desired language.
+
# Edit the textual content of the <u>404_xx.html</u> file translating it from English into the desired language.
# Make sure the page for the language version you are creating uses the correct charset. The charset of X-Cart's 404 error page for the English language is specified in the <u>404_US.html </u>file as iso-8859-1. If the language into which you are translating this page uses a different charset, be sure to correct the encoding and charset values in your <u>404_XX.html </u>file.
+
# Make sure the page for the language version you are creating uses the correct charset. The charset of X-Cart's 404 error page for the English language is specified in the <u>404_en.html </u>file as iso-8859-1. If the language into which you are translating this page uses a different charset, be sure to correct the encoding and charset values in your <u>404_xx.html </u>file.
 
# Save the file.
 
# Save the file.
  
Now any users browsing your store in the language of <u>404_XX.html</u> who get a 404 error will be served the content of <u>404_XX.html</u>.
+
Now any users browsing your store in the language of <u>404_xx.html</u> who get a 404 error will be served the content of <u>404_xx.html</u>.
  
 
'''To make sure the 404 error page works properly''' for a specific language, do the following:
 
'''To make sure the 404 error page works properly''' for a specific language, do the following:
Line 88: Line 88:
 
As a result, you should see your store's 404 error page in the selected language.
 
As a result, you should see your store's 404 error page in the selected language.
  
 +
[[Category:X-Cart user manual]]
 +
[[Category:X-Cart user manual]]
 +
 +
[[Category:X-Cart user manual]]
 
[[Category:X-Cart user manual]]
 
[[Category:X-Cart user manual]]

Latest revision as of 09:59, 3 December 2011

Overview

X-Cart provides a 404 error page. The 404 error page is a page used to display the 'Page not found' error message when a visitor attempts to access the store site using a URL for which no page exists. Typically, this happens if the URL being used is spelled wrong, or if the page being requested has been removed.

The 404 error page in X-Cart serves to provide a more user-friendly experience for your store's users: unlike the default 404 error message returned by the web server, it looks nice, follows the design of the other pages in your store, explains the problem in plain words and provides navigation links allowing the user to try other pages on your store site:


404 customer.gif


At any moment, you can view your store's 404 error page by pointing your browser to the location of your store with the addition of /404.php. For example, if your store's URL is http://example.com, you can view its 404 error page by pointing your browser to http://example.com/404.php.

Please note that X-Cart's 404 error page does not work out of the box. To use it in your store, you need to enable it. The procedure is different depending on the web server you are using. Instructions for enabling the 404 page in X-Cart on the most popular web servers are available in the following sections:

X-Cart's 404 error page is easily customizable. To find out how you can change the content of your store's 404 error page, see the section Customizing X-Cart's 404 Error Page.

The 404 error page included with the X-Cart distribution package is intended for the English language. If you wish to enable the users of your store speaking in languages other than English to read the contents of the 404 error page in their own languages, you must create a version of the

provide 404 error pages for languages other than English, you must create them. For instructions, see the section Creating Versions of the 404 Error Page for Other Languages.

Enabling 404 Error Page on Apache

If you are using Apache web server, to enable use of X-Cart's 404 error page in your store, you must edit the .htaccess file located in your X-Cart installation directory as follows:

  • Uncomment the following line:
# ErrorDocument 404 /404.php

by removing the leading "#".

  • If your X-Cart is installed in a subdirectory (not in the root of the website), edit the uncommented line above to include the full relative path to the 404.php script.

For example, if your X-Cart is installed in the folder /store, so the store is available at the address http://example.com/store/home.php, the said line in your .htaccess file must read as follows:

ErrorDocument 404 /store/404.php

(Note the absence of "#" at the beginning of the line).

Enabling 404 Error Page on IIS

If you are using IIS web server and wish to use X-Cart's 404 error page in your store, you must configure IIS to use the file <xcart_dir>/404.php for the custom 404 error message.

In order to configure IIS, you must be an administrator of the web server (or a member of the Web Site Operators group) and have access to an IIS admin interface. If you do not have administrator privileges and/or physical access to the computer on which the server is run, you will have to ask your administrator to take these steps on your behalf.

To enable use of X-Cart's 404 error page on IIS, do the following:

  1. In the Internet Information Services snap-in, select your website, right-click, and choose 'Properties'.
  2. Select the 'Custom Errors' tab.
  3. Select the HTTP error that you would like to change, in this case 404.
  4. Click the Edit Properties button.
  5. From the 'Message Type' drop-down box, select File.
  6. Enter the full path that points to the file <xcart_dir>/404.php, or use Browse... to locate this file.
  7. Click the OK button.

Customizing 404 Error Page

The content of X-Cart's 404 error page for the English language is defined by the file 404_en.html located in the directory <xcart_dir>/skin/common_files/404. You can easily change the look and feel, as well as the textual content of your store's 404 error page by editing this file. The editing can be done in X-Cart's built-in template editor (see the section Using Template Editor), or in any decent external text editor.

Creating Versions of the 404 Error Page for Other Languages

If your store supports languages other than English, it is recommended you create a version of the 404 error page for each of the languages in your store. This way your store's non-English speaking users will be able to read the contents of the 404 error page in the language they use to view the rest of your store.

Note: Unless you provide a version of the 404 error page for each of the languages supported by your store, in case of 404 error users that view your store in a language for which no 404 error page exists will be served the first available language version of the 404 error page that X-Cart will be able to find.

To create a version of the 404 error page for a language other than English, do the following:

  1. Save the file 404_en.html from the directory <xcart_dir>/skin/common_files/404 as 404_xx.html, where xx is an ISO 639-1 alpha-2 code of the desired language. You can accomplish this using the 'Browse templates' section of your store's Admin area (Administration menu->Edit templates):
    • Browse to the directory <xcart_dir>/skin/common_files/404.
    • Select the radio button next to the filename 404_en.html.
    • In the section 'Copy selected file to...', enter the filename for the new language version of the 404 error page. For example, if you wish to create a version of the 404 error page in German, you must use the filename 404_de.html.
    • Click the Copy button.
  2. Open the file 404_xx.html that has been created in a text editor. For example, you can use X-Cart's built-in template editor (See Using Template Editor).
  3. Edit the textual content of the 404_xx.html file translating it from English into the desired language.
  4. Make sure the page for the language version you are creating uses the correct charset. The charset of X-Cart's 404 error page for the English language is specified in the 404_en.html file as iso-8859-1. If the language into which you are translating this page uses a different charset, be sure to correct the encoding and charset values in your 404_xx.html file.
  5. Save the file.

Now any users browsing your store in the language of 404_xx.html who get a 404 error will be served the content of 404_xx.html.

To make sure the 404 error page works properly for a specific language, do the following:

  1. On any page within your store, switch the Language selector at the top of the page to the desired language.
  2. Edit the URL in the address bar of your web browser so it points to any location that you know does not exist in your store.
  3. Press Enter.

As a result, you should see your store's 404 error page in the selected language.