php - Codeigniter Unable to load the requested file:

728

I have test my first code but had this error message:

An Error Was Encountered

Unable to load the requested file: first.php

<?php
class Ow extends CI_Controller {

    public function index($a){
        $this->load->view('first');
    }
}
?>

file structure

805

Answer

Solution:

On yourviews folder (application/views). addfirst.php file since it doesn't exists as said in your error message

Example Folder structure:

appname

  • application
    • config
    • controllers
      • Ow.php
    • views
      • first.php
  • system
319

Answer

Solution:

use this .htaccess file in your root directory

DirectoryIndex index.php
RewriteEngine on

RewriteCond $1 !^(index\.php|(.*)\.swf|forums|images|css|downloads|jquery|js|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php?$1 [L,QSA]

People are also looking for solutions to the problem: php - Form Submit through JavaScript function

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.