Solved

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

Posted on 2013-01-26
2
6,272 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: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone 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

Suggested Solutions

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 …
Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

763 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