Difference between revisions of "X-Cart:404 Error Page"
(→Creating Versions of the 404 Error Page for Other Languages) |
|||
(8 intermediate revisions by 3 users not shown) | |||
Line 5: | Line 5: | ||
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: | 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: | ||
− | [[Image:404_customer.gif|610px]] | + | |
+ | [[Image:404_customer.gif|610px|center]] | ||
+ | |||
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 <u>/404.php</u>. For example, if your store's URL is <u>http://example.com</u>, you can view its 404 error page by pointing your browser to <u>http://example.com/404.php</u>. | 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 <u>/404.php</u>. For example, if your store's URL is <u>http://example.com</u>, you can view its 404 error page by pointing your browser to <u>http://example.com/404.php</u>. | ||
Line 11: | 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 56: | 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> | + | 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 64: | Line 66: | ||
{{Note1|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.}} | {{Note1|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: | + | '''To create a version of the 404 error page''' for a language other than English, do the following: |
− | # Save the file <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>/ | + | #* Browse to the directory <u><xcart_dir>/skin/common_files/404</u>. |
− | #* Select the radio button next to the filename <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> | + | #* 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> | + | # 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> | + | # 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> | + | # 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> | + | 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 87: | Line 89: | ||
[[Category:X-Cart user manual]] | [[Category:X-Cart user manual]] | ||
− | [[Category:X-Cart | + | [[Category:X-Cart user manual]] |
+ | |||
+ | [[Category:X-Cart user manual]] | ||
+ | [[Category:X-Cart user manual]] |
Latest revision as of 09:59, 3 December 2011
Contents
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:
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:
- In the Internet Information Services snap-in, select your website, right-click, and choose 'Properties'.
- Select the 'Custom Errors' tab.
- Select the HTTP error that you would like to change, in this case 404.
- Click the Edit Properties button.
- From the 'Message Type' drop-down box, select File.
- Enter the full path that points to the file <xcart_dir>/404.php, or use Browse... to locate this file.
- 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.
To create a version of the 404 error page for a language other than English, do the following:
- 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.
- 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).
- Edit the textual content of the 404_xx.html 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 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.
- 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:
- On any page within your store, switch the Language selector at the top of the page to the desired language.
- 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.
- Press Enter.
As a result, you should see your store's 404 error page in the selected language.