Routing: An Overview
Routing refers to the process of mapping Uniform Resource Locators, or URLs, to specific modules, controllers, and methods within the Trongate framework.
Trongate adopts a segment-based URL routing approach. This strategy promotes the creation of user-friendly and search engine optimized URLs, contrasting with traditional methodologies that often utilize query strings characterized by symbols such as question marks and equals signs.
Routing Example
Consider a scenario where an e-commerce website is being developed to sell laptops. On a website that is built using traditional PHP, a typical product page URL might be constructed like so:
https://example.com/store_items.php?id=35
Trongate’s URL routing system allows for more readable URLs. For example:
https://example.com/lenovo-thinkpad
URL routing not only enhances readability of URLs for users - it may also be benificial for search engine optimization puroposes.
This chapter explores the fundamentals of URL routing with Trongate - including; automatic routing, homepage routing and advanced custom URL routing.