Yasin
Yasin

Reputation: 124

How to solve Codeigniter .htaccess error?

I've the following rules on .htaccess file

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [QSA,L]

But I'm getting this error enter image description here

What to do?

Upvotes: 0

Views: 186

Answers (4)

Madhuri Patel
Madhuri Patel

Reputation: 1270

When creating models, you need to place the file in application/models/ and name the file in all lowercase - like default_model.php

Also one thing is important :

Your model file name must be ucfirst.

The default_model.php should contain the following:

<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');


class Default_model extends CI_Model
{
    public function __construct()
    {
        parent::__construct();
    }
    ...

Upvotes: 1

PHP Geek
PHP Geek

Reputation: 4033

try to use this htaccess

Options All -Indexes
RewriteEngine On
#RewriteCond %{HTTPS} !=on
#RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=302] 
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

Upvotes: 0

Yasin
Yasin

Reputation: 124

I've solved it. My model name was in lower case I've made it UC first. Thanks. default_model.php to Default_model.php

Upvotes: 0

Pavan Nagadiya
Pavan Nagadiya

Reputation: 682

try this one hope so it will helpful for you.

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

Upvotes: 1

Related Questions