ceon_uri_mapping

probably the best Zen Cart URI Mapping/SEO Module in the world! ...ever!

System Requirements

Installation

Installation of the module has been made as simple as possible and shouldn't take long for any stores which have not already modified any of the core files which this module has to modify.

If any of the core files this distribution uses have already been modified (because of another third party module being installed for example) then the changes for the respective files should be applied manually by copying across the appropriate sections of code required for the URI Mapping module. These sections are clearly marked (with “// BEGIN” and “// END” comments) within the sample files provided in this distribution.

Installation Overview

  1. Copy the new files from the distribution into your Zen Cart installation.
  2. Copy the updated core files from the distribution into your Zen Cart installation or modify the respective core files.
  3. Create the necessary database tables.
  4. Add the rewrite rules to Apache.
  5. Create the database tables, configure the URI auto-generation settings and set up the URI mappings for categories, products and EZ-Pages.

Installation Steps

  1. New Files

    These are the new files which make up this module. Copy them all into their respective folders in your Zen Cart installation.

    They already have the correct folder structure, so a single drag-and-drop of the folders/files in the files folder into the root directory for the store will put the files in the correct locations; there's no need to copy the files individually - that often results in files being missed out!

    • admin/images/ceon_button_logo.png
    • admin/includes/boxes/extra_boxes/ceon_uri_mapping_modules_dhtml.php
    • admin/includes/classes/transliteration (* ALL files in this directory!)
    • admin/includes/classes/class.String.php
    • admin/includes/classes/class.Transliteration.php
    • admin/includes/extra_datafiles/ceon_uri_mapping_database_tables.php
    • admin/includes/extra_datafiles/ceon_uri_mapping_filenames.php
    • admin/includes/functions/extra_functions/ceon_uri_mapping.php
    • admin/includes/languages/english/extra_definitions/ceon_uri_mapping.php
    • admin/includes/languages/english/ceon_uri_mapping_config.php
    • admin/ceon_uri_mapping_auto_upgrade.php
    • admin/ceon_uri_mapping_config.php
    • includes/auto_loaders/config.ceon_uri_mapping.php
    • includes/extra_datafiles/ceon_uri_mapping_database_tables.php
    • includes/extra_datafiles/ceon_uri_mapping_filenames.php
    • includes/init_includes/init_ceon_uri_mapping.php
  2. Updated Core Files

    A few core Zen Cart admin files must be updated to work with the URI Mapping module.

    • It is likely that none of these files have been modified for the store already, in which case the modified files from this distribution should simply be copied over the existing version of the files for the version of Zen Cart being used by the store.

    • However, if any of these core files have already been modified for the store, the changes within the modified sample files included in this distribution must be applied to the previously modified core files.

      The changes are clearly marked within the sample files in the distribution and should be easy enough to copy across, especially if a “diff” software package (such as the free WinMerge software or the commercial Beyond Compare software) is used.

      Instructions on how to copy across the modifications necessary for this module - to core files which you have already updated - can be found in this FAQ.

    The modified core files can be found within the modified_core_files folder in the distribution. A list of the files follows.

    If any of the “Product Types” (e.g. Document General or Product Book) aren't used by the store, there's no need to copy/modify the files in the respective directories (e.g. document_general or product_book).

    If the store's core files haven't been modified then there's no need to copy the files individually - that often results in files being missed out! They already have the correct folder structure, so a single drag-and-drop of the folders/files in the modified_core_files folder (for the exact same version of Zen Cart) into the root directory for the store will put the files in the correct locations.

    • admin/includes/modules/document_general/collect_info.php
    • admin/includes/modules/document_general/preview_info.php
    • admin/includes/modules/document_product/collect_info.php
    • admin/includes/modules/document_product/preview_info.php
    • admin/includes/modules/product/collect_info.php
    • admin/includes/modules/product/preview_info.php
    • admin/includes/modules/product_book/collect_info.php
    • admin/includes/modules/product_book/copy_to_confirm.php
    • admin/includes/modules/product_book/delete_product_confirm.php
    • admin/includes/modules/product_book/preview_info.php
    • admin/includes/modules/product_book/update_product.php
    • admin/includes/modules/product_free_shipping/collect_info.php
    • admin/includes/modules/product_free_shipping/preview_info.php
    • admin/includes/modules/product_music/collect_info.php
    • admin/includes/modules/product_music/copy_to_confirm.php
    • admin/includes/modules/product_music/delete_product_confirm.php
    • admin/includes/modules/product_music/preview_info.php
    • admin/includes/modules/product_music/update_product.php
    • admin/includes/modules/copy_to_confirm.php
    • admin/includes/modules/delete_product_confirm.php
    • admin/includes/modules/move_product_confirm.php
    • admin/includes/modules/sidebox_move_product.php
    • admin/includes/modules/update_product.php
    • admin/categories.php
    • admin/ezpages.php
    • admin/product.php
    • includes/functions/html_output.php
  3. Create the necessary Database Tables

    The database tables required by the module are automatically created by an installation and upgrade script.

    This script runs automatically when the configuration utility is accessed. (In the future, should you need to upgrade the module, you should also access the configuration utility then.)

    • Simply go to Modules > URI Mapping Config in the Admin and the database tables will be automatically created.

  4. Add the Rewrite Rules to Apache.

    The URI mapping provided by this module is made possible using some very simple URI rewriting rules.

    These rules must be added to the webserver configuration for the site.

    For the Apache webserver, these rules can either be put in the VirtualHost directive for the site or within a .htaccess file (if the appropriate security settings allow its use within .htaccess files).

    If putting these rules in a VirtualHost directive, it is likely that a forward slash has to be added to index.php. See this FAQ for more info.

    Details of how to enable mod_rewrite or how to add these rules to the Apache configuration will not be given here, please consult the Apache documentation or search the internet for a guide, there are plenty of them.

    If an error is encountered, please consult the FAQs for possible fixes or ask your webhost for help. Only after trying those two options should you post to the forum as the problem is likely server-specific and therefore of no general interest to everyone else who needs to use the support thread!

    The required rewrite rules are below.

    Please Note: These rewrite rules are for sites which have Zen Cart installed in the root folder of their site and which have not renamed the admin directory from “admin&rdquo to something else. For Zen Cart installations which use a different folder for the store and/or a different admin folder, information on how to modify these rewrite rules appropriately follows also.

    Example rules for stores installed in the root of the site, with the admin named “admin”
    • RewriteEngine On
      
      # Don't rewrite any files ending with .[xxxx], except for scripts/HTML files
      RewriteCond %{REQUEST_URI} !\.[a-zA-Z]{2,4}$ [OR]
      RewriteCond %{REQUEST_URI} \.(php|xml|html|htm|aspx)$ [NC]
      # Don't rewrite cpanel directories
      RewriteCond %{REQUEST_URI} !/cpanel.* [NC]
      RewriteCond %{REQUEST_URI} !/frontend.* [NC]
      # Don't rewrite admin directory
      RewriteCond %{REQUEST_URI} !/admin.* [NC]
      # Don't rewrite payment pages/callback handlers
      RewriteCond %{REQUEST_URI} !/ipn_main_handler.php.* [NC]
      RewriteCond %{REQUEST_URI} !/iridium_3d_secure_iframe.php.* [NC]
      RewriteCond %{REQUEST_URI} !/localities_remote_loader.php.* [NC]
      RewriteCond %{REQUEST_URI} !/nochex_apc_handler.php.* [NC]
      RewriteCond %{REQUEST_URI} !/protx_direct_3d_secure_iframe.php.* [NC]
      RewriteCond %{REQUEST_URI} !/realex_remote_3d_secure_iframe.php.* [NC]
      # Handle all other URIs/file types (php|html|htm etc.) using Zen Cart (index.php)
      RewriteRule (.*) index.php?%{QUERY_STRING} [L]
      

    If the store uses any control panels etc. which are blocked because of the rewrite rules, a rewrite rule must be added to allow access again. More information can be found in this FAQ.

    Example rules for stores installed in a folder other than the root of the site, with the admin named “admin”

    As mentioned above, if a store is not installed in the root directory of a site, that is, if in includes/configure.php the DIR_WS_CATALOG define isn't exactly as follows:

    define('DIR_WS_CATALOG', '/');

    Then the rewrite rules need to be modified to point to the store's folders.

    For example, if the store's DIR_WS_CATALOG define is:

    define('DIR_WS_CATALOG', '/shop/');

    Then all of the rewrite rules from “# Don't rewrite admin directory” downwards need to have the forward slash, “/”, changed to “/shop/”.

    The main RewriteRule also needs to have the store's directory path prepended.

    If the store has other pages on the site which aren't part of Zen Cart - that is, from the example above, pages which aren't in the “/shop” directory - then a rewrite rule must also be added so that these other pages keep working.

    The resulting rewrite rules would then be as follows:

    • RewriteEngine On
      
      # Don't rewrite any files ending with .[xxxx], except for scripts/HTML files
      RewriteCond %{REQUEST_URI} !\.[a-zA-Z]{2,4}$ [OR]
      RewriteCond %{REQUEST_URI} \.(php|xml|html|htm|aspx)$ [NC]
      # Only rewrite pages inside the shop directory
      RewriteCond %{REQUEST_URI} ^/shop/.* [NC]
      # Don't rewrite admin directory
      RewriteCond %{REQUEST_URI} !/shop/admin.* [NC]
      # Don't rewrite payment pages/callback handlers
      RewriteCond %{REQUEST_URI} !/shop/ipn_main_handler.php.* [NC]
      RewriteCond %{REQUEST_URI} !/shop/iridium_3d_secure_iframe.php.* [NC]
      RewriteCond %{REQUEST_URI} !/shop/localities_remote_loader.php.* [NC]
      RewriteCond %{REQUEST_URI} !/shop/nochex_apc_handler.php.* [NC]
      RewriteCond %{REQUEST_URI} !/shop/protx_direct_3d_secure_iframe.php.* [NC]
      RewriteCond %{REQUEST_URI} !/shop/realex_remote_3d_secure_iframe.php.* [NC]
      # Handle all other URIs/file types (php|html|htm etc.) using Zen Cart (index.php)
      RewriteRule (.*) shop/index.php?%{QUERY_STRING} [L]
      

    Modifying the rules for stores which have renamed the admin directory

    If the store does not use “admin” for the name of the admin directory then the rewrite rule for the admin directory must be modified: “RewriteCond %{REQUEST_URI} !/admin.* [NC]”.

    For example, if the store's admin directory is named “store_manager” and Zen Cart is installed in the root directory of the site, the example rewrite rules above would be modified as follows:

    # Don't rewrite admin directory
    RewriteCond %{REQUEST_URI} !/store_manager.* [NC]

    Obviously, if the store isn't installed in the root directory of the site, the rewrite rule for the admin folder would have to be modified accordingly. As an example:

    # Don't rewrite admin directory
    RewriteCond %{REQUEST_URI} !/shop/store_manager.* [NC]

  5. Create the Database Tables, Configure the URI Auto-generation Settings and Set Up the URI Mappings for Categories, Products and EZ-Pages.

    Now all that has to be done is to create the database tables the module uses, configure the URI auto-generation settings and set up the URI mappings for the store in the Zen Cart Admin.

    The database tables are created automatically upon accessing the configuration utility:

    • Go to Modules > URI Mapping (SEO) Config in the Zen Cart admin.

    Details of how to configure the URI auto-generation settings and set up the URI mappings for the store are provided in the configuration section.

Back to top