• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Beginner 404 Error

#1
404 Page Not Found
The page you requested was not found.

I have been following a tut in the book professional codeigniter by Thomas Myer from wrox based on version 1.7

Leaving the world of .NET I have been working with raw php for the past year, now I thought it was time to learn a framework. Codeigniter was the framework of choice.

I was expecting some problems by using a book from version 1.7 and trying to apply it to version 3 but I did not expect the problem right from the start.

$autoload['libraries'] = array('database', 'session', 'email', 'validation');
$autoload['helper'] = array('url','form','text','date','security');
$autoload['model'] = array('MProducts', 'MPats');

Error on validations so I removed it from the autoload file.

$route['default_controller'] = 'welcome';

$config['base_url'] = 'http://savingonlinenow.com/test/';
I'm not sure why /test/?

$config['index_page'] = ' ';

.htaccess
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]

So the real question is how does all of this work? what page can not be found? what is loaded first? how do I get to some default index page and where is that? does the controller tell the view to show?
Reply

#2
I think, the best way how to learn CodeIgniter 3 is from documentation, especially Tutorial and General Topics sections. There are an answers for all your questions.

From what you wrote, I am not able to find what is causing your problem. Blind guess: it might be something with routing.
Reply

#3
Another blind guess: your controllers and models are in lower case. CI 3.x requires your all files that are php classes, to be in firstcaps.
Besides that, give $config['base_url'] an empty value; CI will determine by itself what the full path to your index.php is.
$config['base_url'] = '' will work fine in most cases.
Reply

#4
Quote:$config['base_url'] = 'http://savingonlinenow.com/test/';
I'm not sure why /test/?
/test/ mean that your controller name is Test
Reply

#5
(09-28-2015, 01:43 AM)Hyper-X Wrote:
Quote:$config['base_url'] = 'http://savingonlinenow.com/test/';
I'm not sure why /test/?
/test/ mean that your controller name is Test

No, /test/ means the folder where the index.php is. But maybe it is wrong.
Do you have a folder named test in your web document root?
Do you want to write tests for your apps? Our book, CodeIgniter Testing Guide would help you.
Reply

#6
(09-27-2015, 09:41 AM)Muzikant Wrote: I think, the best way how to learn CodeIgniter 3 is from documentation, especially Tutorial and General Topics sections. There are an answers for all your questions.

From what you wrote, I am not able to find what is causing your problem. Blind guess: it might be something with routing.

I just went through the first tutorial and thanks for the advice
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.