See the 6 Comments
Custom URL Routing for PrestaShop Modules
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
- 2) Details of an Order
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