• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
getting a not found error

#1
"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';
proof that an old dog can learn new tricks
Reply

#2
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.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply

#3
(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
proof that an old dog can learn new tricks
Reply

#4
(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().
proof that an old dog can learn new tricks
Reply

#5
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. 
proof that an old dog can learn new tricks
Reply

#6
Hi,

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

And it should all work
A good decision is based on knowledge and not on numbers. - Plato

Reply

#7
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.
proof that an old dog can learn new tricks
Reply

#8
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.
A good decision is based on knowledge and not on numbers. - Plato

Reply

#9
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_cru...gure/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?
proof that an old dog can learn new tricks
Reply

#10
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?
proof that an old dog can learn new tricks
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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