Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

The Dispatcher

The Dispatcher is one of the main technical features of v1.5. It handles URL redirections. Instead
For instance, instead of using multiple files in the root folder like product.php, order.php or category.php, PrestaShop only uses one file is used: index.php. From now on, internal URL will look like

Starting with PrestaShop 1.5, front-office URLs look like this:

  • /index.php?id_category=3&controller=category

...

  • /index.php?id_product=7&controller=product
  • /index.php?id_cms=4&controller=cms
  • etc.

Likewise, back-office URLs look like this:

  • /admin-dev/index.php?controller=AdminDashboard
  • /admin-dev/index.php?controller=AdminProducts
  • /admin-dev/index.php?controller=AdminCmsContent
  • etc.

Additionally, the Dispatcher is built to support URL rewriting (or "Friendly URLs"). Therefore, PrestaShop URLs which look like this when URL-rewriting is off, PrestaShop will use the following URL form:...

Code Block
http://myprestashop.com/index.php?controller=category&id_category=3&id_lang=1
http://myprestashop.com/index.php?controller=product&id_product=1&id_lang=2

...and will look like this when URL-rewriting is on (or "Friendly URLs"), PrestaShop's Dispatcher will correctly support this URL form:

Code Block
http://myprestashop.com/en/3-music-ipods
http://myprestashop.com/fr/1-ipod-nano.html

There are several advantages for to this system:

  • It is easier to add a controller.
  • You can use custom routes to change your friendly URLs (which is really better for SEO!)
  • There is only one single entry point into the software, which improves PrestaShop's reliability, and facilitates future developments.

...

New routes can be created by overriding the loadRoutes() method.
The store's administrator can change a controller's URL using the "SEO & URLs" page in the back-office's "Preferences" menu.