Lulzim
Lulzim

Reputation: 905

Codeigniter 404 error page, routing issue

I have uploaded my web project using codeigniter on the server godaddy and I can access it thru this link http://izhi-ks.org/facelajm/blog

I have bought a new domain www.facelajm.com for this site, and I have updated the directory to /facelajm and I get 404 Page Not Found error.

so my ftp looks like this:

in the root I have another site which is joomla and within that dir I ahave a folder called facelajm.

In the codeigniter root dir i have a .htaccess like this:

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

What I am doing wrong, that I cant open the site only by typing www.facelajm.com In fact it does if i only create a new index.php and print hello world... I am doubting on the htaccess or maybe config file?

here is config.php as well:

$config['base_url'] = "";

$config['index_page'] = '';

$config['uri_protocol'] = 'AUTO';

Upvotes: 3

Views: 38556

Answers (4)

Vladymir Gonzalez
Vladymir Gonzalez

Reputation: 456

If you using Codeigniter V3, check the first letter of your controller is in upper case, example:

 ci/application/controllers/dealer/Api.php 

Upvotes: 4

Lucas Bustamante
Lucas Bustamante

Reputation: 17178

I migrated to a new environment and it started showing 404 on all subpages. I had to edit Apache's httpd.conf, replacing all instances of AllowOverride None to AllowOverride All (lines 231 and 268 in my case). Reloaded Apache and it worked fine without any further changes.

Upvotes: 0

Amit Kumar PRO
Amit Kumar PRO

Reputation: 1240

update your config file

/* your base url or your domain name for your application*/
$config['base_url'] = "http://example.com"; 

/*For your default index page generally this is empty */
$config['index_page'] = '';

Upvotes: 1

doitlikejustin
doitlikejustin

Reputation: 6353

Change your .htaccess in the facelajm directory (which should be the root of your domain) to the following. I think you forgot to turn on RewriteEngine and forgot to set RewriteBase:

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

Update

A default controller needs to be set in routes.php

$route['default_controller'] = 'blog';

Upvotes: 9

Related Questions