Link to home
Start Free TrialLog in
Avatar of sniger
sniger

asked on

codeigniter - The requested URL /index.php was not found on this server.

Hi, I am trying to call a function from the main controlled and
getting the error:

Not Found

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

Here is my setup:
.htaccess in my site root directory
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    #http://codeigniter.com/wiki/mod_rewrite/
    #Removes access to the system folder by users.
    #Additionally this will allow you to create a System.php controller,
    #previously this would not have been possible.
    #'system' can be replaced if you have renamed your system folder.
    RewriteCond %{REQUEST_URI} ^system.*
    RewriteRule ^(.*)$  index.php?/$1 [L]
    
    #When your application folder isn't in the system folder
    #This snippet prevents user access to the application folder
    #Submitted by: Fabdrol
    #Rename 'application' to your applications folder name.
    RewriteCond %{REQUEST_URI} ^application.*
    RewriteRule ^(.*)$ index.php?/$1 [L]

    #Checks to see if the user is attempting to access a valid file,
    #such as an image or css document, if this isn't true it sends the
    #request to index.php
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>

<IfModule !mod_rewrite.c>
    # If we don't have mod_rewrite installed, all 404's
    # can be sent to index.php, and everything works as normal.
    # Submitted by: ElliotHaughin

    ErrorDocument 404 index.php
</IfModule>  

Open in new window


main controller:  - main controller which executes fine

<?php

 class main_ctrl extends CI_Controller {
 	 	
 	function __construct()   // called every time controller is loaded
 	{	
 		 		
 			
 		parent:: __construct();	
 		$this->load->model('user');
 
 
 		$this->user->initialize($email);  // initialize and serialize user model
 		$this->data['user_fn'] = $this->user->First_name;
 		$this->data['user_ln'] = $this->user->Last_name;
 	 
 		$this->load->helper('url');
 		
 
 		$this->load->view(home,$this->data);

 		
 		
 		
 	}	
    
 	function index()
 	{
 		
 	}	 	
	

 	function edit()
 	{

 		$this->data['curr']  = $this->user->Currcde;  		 		
 		$this->load->view(profile,$this->data);
 	
 	}
 	
  }
  
 ?>

Open in new window


but edit function called from the view:

a class="info" href="<?php echo base_url()?>main_ctrl/edit" target="_blank" title="Me"> <?php echo $user_fn . "&nbsp;" . $user_ln."'s Profile";	?>  </a> &nbsp;

Open in new window


gives index error
Avatar of Devario Johnson
Devario Johnson
Flag of United States of America image

Im not familiar with codignighter but maybe this might work link
ASKER CERTIFIED SOLUTION
Avatar of mcnute
mcnute
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial