Solved

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

Posted on 2013-01-26
2
6,699 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

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

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…
Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
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…
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.

623 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