Solved

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

Posted on 2013-01-26
2
6,081 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
ID: 38823534
Im not familiar with codignighter but maybe this might work link
0
 
LVL 11

Accepted Solution

by:
mcnute earned 500 total points
ID: 38824138
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

860 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