@lindsey.homenick
To generate SEO-friendly URLs using Kohana, you can follow these steps:
For example, you can define a route like this:
1 2 3 4 5 |
Route::set('product', 'product/<id>', array('id' => 'd+')) ->defaults(array( 'controller' => 'product', 'action' => 'view', )); |
This route will match URLs like /product/123
and map them to the view
action of the ProductController
, passing the product ID as a parameter.
For example, you can generate a URL to view a specific product like this:
1 2 |
$product_id = 123; $url = URL::site('product/'.$product_id); |
This will generate a URL like /product/123
using the routing rule you defined earlier.
By following these steps, you can generate SEO-friendly URLs using Kohana that can help improve your site's search engine rankings and make it easier for users to navigate your site.