tags:

views:

25

answers:

1

Hi all!

I've only just started using Kohana ( 3 hours ago), and so far it's blown my socks off (and I'm wearing slippers, so that's quite impressive).

Right now, I have a controller 'Controller_FrontPage' with associated views and models and I'm trying to get it accesible from the root of my website (eg, http://www.mysite.com/). If I edit the default controller in the bootstrap from:

Route::set('default', '(<controller>(/<action>(/<id>)))')
->defaults(array(
    'controller' => 'welcome',
    'action'     => 'index',
));

to 'controller' => '', I get an error, could not find controller_ (which makes sense), and if I change it to 'controller' => '/', I get an error, could not find controller_/ (which also makes sense).

If I set 'controller' => 'FrontPage', everything works fine, but all my links (html::anchor(...)) point to http://www.mysite.com/FrontPage/*.

Is there a way to have all the anchors point to http://www.mysite.com/*?

+1  A: 

Take a look at this page in the Unofficial Kohana 3.0 Wiki about Removing the index.php file from the URL: http://kerkness.ca/wiki/doku.php?id=removing_the_index.php

You will also want to learn more about how routes work as the approach you're taking with routes isn't what you want to do. By changing the route to

'controller' => ''

or

'controller' => '/'

you're breaking the route because the route no longer specifies a controller. Routes are a very powerful part of KO3 and will be a great thing to learn more about. Take a look at this URL for info about routes - http://kohanaframework.org/guide/tutorials.urls

Let me know if you have follow up questions based on the Unofficial Wiki page.

Bart

Bart Gottschalk