Seyed Mostafa Baghi
Seyed Mostafa Baghi

Reputation: 23

Codeigniter Unable to load the requested file:

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

Upvotes: 0

Views: 8768

Answers (2)

VR Patel
VR Patel

Reputation: 61

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]

Upvotes: 0

ivanavitdev
ivanavitdev

Reputation: 2888

On your views folder (application/views). add first.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

Upvotes: 1

Related Questions