jeeva
jeeva

Reputation: 1603

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?

Upvotes: 0

Views: 586

Answers (2)

pogeybait
pogeybait

Reputation: 3145

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'
    ));

Upvotes: 1

gspatel
gspatel

Reputation: 1128

Proper SEO? That seems like you're going in the wrong direction.

But...if you really want to do this...add a route in your bootstrap.php:

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

Upvotes: 0

Related Questions