CodeIgniter Forums
getting a not found error - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forum-5.html)
+--- Forum: General Help (https://forum.codeigniter.com/forum-24.html)
+--- Thread: getting a not found error (/thread-73301.html)

Pages: 1 2


getting a not found error - richb201 - 04-09-2019

"The requested URL /sub_crud/Configure/index was not found on this server."

I am trying to setup a development env on a Ubuntu PC. I have moved my code across and am able to get the program to start. The first line, after logging in is to run the index function in the Configure controller. This is failing with the error above. The actual path to my program is /var/www/html/sub_crud/application/controllers/Configure.php and in it I have a function called index(). I am thinking that there is some path I didn't set up for Codeigniter?

I have set $config['base_url'] = 'http://localhost/sub_crud'; in config.php
I have index.php at /var/www/html/sub_crud
$system_path = 'system';
$application_folder = 'application';


RE: getting a not found error - InsiteFX - 04-09-2019

Where is your index.php file located to the system and application folders?

I have my index.php under public_html

application
public_html
-- assets
-- index.php
system

With that setup I have to do a '../application' and a '../system' in the index.php file.


RE: getting a not found error - richb201 - 04-09-2019

(04-09-2019, 12:28 PM)InsiteFX Wrote: Where is your index.php file located to the system and application folders?

I have my index.php under public_html

application
public_html
-- assets
-- index.php
system

With that setup I have to do a '../application' and a '../system' in the index.php file.

I have index.php directly in /var/www/html/sub_crud/. 

sub_crud
--application
--assets
--system
index.php


RE: getting a not found error - richb201 - 04-09-2019

(04-09-2019, 01:30 PM)richb201 Wrote:
(04-09-2019, 12:28 PM)InsiteFX Wrote: Where is your index.php file located to the system and application folders?

I have my index.php under public_html

application
public_html
-- assets
-- index.php
system

With that setup I have to do a '../application' and a '../system' in the index.php file.

I have index.php directly in /var/www/html/sub_crud/. 

sub_crud
--application
--assets
--system
index.php

Where is the path to index.php set in linux? Is that a codeigniter setting ?  Is there an environment variable that holds that path? I can run phpinfo().



RE: getting a not found error - richb201 - 04-09-2019

BTW, I don't think it is a problem getting to index.php in the document root since one of my controllers (the login one) runs fine. I think that it is not finding Controller/index which should be a function called "index" in the Controller "Configure".

Not Found
The requested URL /sub_crud/Configure/index was not found on this server.

The way I am getting here is by running this line in the login controller:
redirect('/Configure/index'); //success

So this is the "index" that is not being found!

Here is the function index() that is not being found.


public function index()
{
   $this->_configure_output((object)array('output' => '''js_files' => array(), 'css_files' => array()));
   [i]//this is to put the system in maint mode. This is set by the cronjob
   if(file_exists('cron.lock'))
   {
       show_error("The Substantiator is down for weekly maintanance. ",400,"System down");
       exit(0);
   }
   $this->campaign_management_with_actions();
}
[/i]


So it comes down to the code not understanding that I am trying to run the index() function in the Configure controller. BTW, this code runs fine on my remote linux server which makes me think it is a config issue on this ubuntu PC. 


RE: getting a not found error - salain - 04-10-2019

Hi,

Change :redirect('/Configure/index'); //success
For : redirect('/configure/index'); //success

And it should all work


RE: getting a not found error - richb201 - 04-10-2019

salain, why would that work? This being Linux, it is case sensitive. All of my controllers start with a capital. This code, btw, works on an AWS server.

I just tried it and I got this error now:

The requested URL /sub_crud/configure/index was not found on this server.


RE: getting a not found error - salain - 04-10-2019

Hi,

I cannot remember where I got this. but I had issues before using capital letters in URL before with CI.
Do you have any route or does mod_rewrite work to remove the index from the url?
Some code could help.


RE: getting a not found error - richb201 - 04-10-2019

Thanks salain. The only code that is failing is redirect('/Configure/index);

CI is appending /sub_crud/ onto that. I start my app by typing /localhost/sub_crud in the browser. There must be some difference between the AWS linux host and my Ubuntu PC. Here is how the same page gets called on AWS:

https://www.rdsubstantiation.com/sub_crud/Configure/index

on the ubuntu PC it is
http://localhost/sub_crud/Configure/index

This works. How about the fact that I don't have https installed on my ubuntu PC. Could that be the issue?


RE: getting a not found error - richb201 - 04-10-2019

I have figured out that this line works:

http://localhost/sub_crud/index.php/Configure/index

I have .htaccess in my sub_crud directory. It contains:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

I thought that this would work to NOT require index.php in the URI's. How can I turn off the requirement for index.php? Is my .htaccess in the wrong directory?