Using hyphen (-) in URL's

If you prefer hyphen (-) in your project URL's, this is simple extending Kohana Request class (application/classes/request.php) to handle it:

<?php defined('SYSPATH') or die('No direct script access.');
class Request extends Kohana_Request
	public function execute()
		$this->action(str_replace('-', '', $this->action()));
		$this->controller(str_replace('-', '', $this->controller()));
		return parent::execute();

This will eliminate any hyphens to controllers and actions.

Allows for example a URL this-company/about-us be directed to the controller thiscompany and action aboutus

routing/using_hyphen_in_urls.txt · Last modified: 2011/06/14 21:14 by marcelorodrigo