CodeIgniter Forums

Full Version: [SOLVED] Scaffolding problem
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

Hi there, these are my first days coding with CI and I have a quick question.

When trying scaffolding I can only access the default page, but when I click on Add or View - I get a 404 error.

I have tried to search this forum for similar topics - i found loads of them. So i checked my config files, my controller file etc.

file: application/config/config.php
$config['base_url']    = "http://webz/";

file: application/config/routes.php
$route['default_controller'] = "notes";
$route['scaffolding_trigger'] = "scaff";

file: application/controllers/notes.php
function __construct()

the address that i use to load scaffolding is http://webz/notes/scaff

Can you help me? Must be something simple, but I spend couple of hours already trying to figure it out...

El Forum

Hi zovar, do you have an .htaccess file setup with mod_rewrite? I usually get 404's only if I've forgotten my .htaccess file.

You'll need the .htaccess file for clean URL's, if you don't have a .htaccess file, I've included the one I use below. Alternatively if you don't want to use clean URL's you can try going to http://webz/index.php/notes/scaff and see if it works for you.

Options +FollowSymLinks
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php/$1 [L]
    RewriteCond %{HTTP_HOST} ^www\.(.8)$
    RewriteRULE (.*) http://%1/$1 [R=301,L]
<IfModule !mod_rewrite.c>
    ErrorDocument 404 /index.php

El Forum

Thank you, but no, it didn't work.

I have set up mod_rewrite, and it works fine (otherwise I wouldn't be able to access any controller without an index.php in the address?..)

Do you have any other thoughts?

What seems weird to me is that the edit link from the scaffolding "homepage" goes to http://webz/edit/1 but not to http://webz/notes/edit/1 (although I tried this address and it didn't work)?

Should a controller be included in this address?

El Forum


After comparing autoload.php files from fresh and old installation line by line, I have found the problem. Don’t autoload ‘uri’ library! It load automatically and if you load it for the second time - it will brake itself.

I think the official tutorial still contains an advice to load it manually though…