Reputation: 383
I am setting up my new web application using the Kohana framework.
I am using MAMP so the app is located in the htdocs
folder, with this structure:
---htdocs
--foo
-application
I am getting this error when viewing http://localhost:8888/foo/
Kohana_HTTP_Exception[ 404 ]: The requested URL foo was not found on this server.
In the bootstrap.php
the route is the default Kohana one
Route::set('default', '(<controller>(/<action>(/<id>)))')->defaults(
array(
'controller' => 'welcome',
'action' => 'index',
));
Upvotes: 1
Views: 348
Reputation: 17028
Check your application/bootstrap.php
file for:
Kohana::init(array(
'base_url' => '/foo/',
));
This is required for Kohana to understand it's in /foo/
folder.
UPD
The requested URL foo was not found on this server
exception message is generated if no action_<action>
method was found in Controller.
If no Route was found Unable to find a route to match the URI:
exception message is genereted.
Not shure Routing works as expected, but it works ;).
So check your Controller file for apropriate action method.
Upvotes: 2
Reputation: 1895
This is would be my prefered folder structure for a Kohana application under /foo
:
├─┬─ htdocs
│ └─┬─ foo
│ ├─── .htaccess
│ └─── index.php
└─┬─ kohana
├─┬─ application
│ ├─── bootstrap.php
│ └─── etc...
├─┬─ modules
│ └─── etc...
├─┬─ system
│ └─── etc...
├─── index.php
├─── install.php
└─── etc...
htdocs/foo/index.php:
<?php
require '../../kohana/index.php';
htdocs/foo/.htaccess:
# Turn on URL rewriting
RewriteEngine On
# Installation directory
RewriteBase /foo/
# Protect hidden files from being viewed
<Files .*>
Order Deny,Allow
Deny From All
</Files>
# Allow any files or directories that exist to be displayed directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Rewrite all other URLs to index.php/URL
RewriteRule .* index.php/$0 [PT]
In kohana/application/bootsrap.php set 'base_url' to foo:
Kohana::init(array(
'base_url' => '/foo/',
'index_file' => NULL,
));
If you want to run kohana/install.php create htdocs/foo/install.php and require '../../kohana/install.php';
This way you keep your htdocs clean. If your live server would ever stop processing PHP files for some reason the only thing people will get to see is a require to Kohana's index.php
.
The RewriteCond for the application
, modules
and system
folders is not needed.
Turning on maintenance mode is very easy.
Upvotes: 0