Custom URL Routing for PrestaShop Modules

By - January 31, 2013

ShareTweet about this on Twitter0Share on Facebook0Share on Google+0Share on LinkedIn0

See the6 Comments

PrestaShop v1.5 revolutionized the way you control and customize URLs. From Friendly URLs, to customized URL routing, PrestaShop is the e-commerce software on the forefront of URL capabilities.

In v1.5.3, we’ve added a small new feature to the URL dispatcher to further enhance URL rewriting capabilities. It is now possible to add custom URL routes for modules. Let’s see how it works.

Here’s an example:
Let’s name a new Module called “mymodule”.
“mymodule” has two main functions.

1) It will show a page list of commands for any user on your site
2) You can use “mymodule” to see the details of an order

Page list of commands

  • Friendly URL Disabled: http://www.yourstore.com/index.php?fc=module&module=monmodule&controller=orders&module_action=listing
  • Friendly URL Enabled: http://www.yourstore.com/module/monmodule/orders?module_action=listing

Details of an order

  • Friendly URL Disabled: http://www.yourstore.com/index.php?fc=module&module=monmodule&controller=orders&module_action=details&id_order=42
  • Friendly URL Enabled: http://www.yourstore.com/module/monmodule/orders?module_action=details&id_order=42

The principle of using Friendly URLs is to have nice, clean, SEO Friendly URLs that are naturally readable by search engines and customers alike. However, even with Friendly URLs turned on, sometimes the URLs can still look strange. This is clearly the case with the two examples above, even with Friendly URLs turned on.

PrestaShop v1.5.3 comes equipped with the ability to add custom routes for a module. Using Friendly URLs, alongside with a custom route for the module we created, allows us to alter each URL to look fresh and clean. Check out the URLs now that we’ve added a custom route.

  • 1) Page list of commands
    http://www.yourstore.com/module/mymodule/orders/listing
  • 2) Details of an Order
    http://www.yourstore.com/module/mymodule/orders/details/42

The difference is remarkable. In the above examples, you can now see how much easier the URLs are to read. This is an example of the awesome power and control you have over your URLs by using PrestaShop.

If you have a server that can handle URL rewriting, and have Friendly URL’s turned on, you can navigate to Preferences>SEO and URL’s> Schema of URL’s to view all the customization features you can add.

Receive articles like this in your inbox!

Subscribe to get the latest ecommerce news and tips sent directly to your email. Subscribe

ShareTweet about this on Twitter0Share on Facebook0Share on Google+0Share on LinkedIn0

See the6 Comments

Comments (6)

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>