Search code examples
.htaccessurlbootstrappingkohana-3.2

how to rewrite url's as proper SEO url in kohana 3.2?


I'm using kohana3.2. i want to rewrite the url's in t o proper SEO url's. For ex, my url is now http://samplesite.com/user/register/ . but i want my url as http://samplesite.com/register.html.

In 2.3.4 version of kohana , in routes file (application/config/routes.php) we will do the changes ..

How to do it in kohana 3.2?


Solution

  • Probably not the answer you are looking for but Kohana is setup to use pretty urls so what you are trying to do, as already stated, is going backwards but you can setup a specific route like so:

    Route::set('seo', '<controller>/<action>.html')
        ->defaults(array(
            'controller' => 'page',
            'action'     => 'index'
        ));
    

    You would still need to specify the controller and action but at least you can have the .html on the end. In the case of this route, you have to use http://domain.com/user/register.html.

    If you want to use one route per url, you can also use:

    Route::set('seo', 'register.html')
        ->defaults(array(
            'controller' => 'user',
            'action'     => 'register'
        ));