Solved

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

Posted on 2013-01-26
2
5,423 Views
Last Modified: 2013-01-27
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
0
Comment
Question by:sniger
2 Comments
 
LVL 5

Expert Comment

by:Devario Johnson
Comment Utility
Im not familiar with codignighter but maybe this might work link
0
 
LVL 11

Accepted Solution

by:
mcnute earned 500 total points
Comment Utility
In your base_url() method is still an index.php postfix. You can disable it by modifying the following line in config.php:

$config['index_page'] = '';

Open in new window


Basically you just erase the index.php within the quotes and your script should work again.
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to count occurrences of each item in an array.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now