codeigniter page not found 404

I'm working on website that made by someone else using codeIgniter, when I upload it on my local server it says object not found so I added the .htacess file to remove the index.php from the link

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

and I faced another issue which is the page display 404 page not found (not the same issue before it) and my config file like this, base_url :

$root  = "https://".$_SERVER['HTTP_HOST'];
$root .= str_replace(basename($_SERVER['SCRIPT_NAME']),"",$_SERVER['SCRIPT_NAME']);
$config['base_url'] = $root;

index page: $config['index_page'] = '';

uri protocol: $config['uri_protocol'] = 'REQUEST_URI';

and it's work when I add "index.php" in the link.

Upvotes: 0

Views: 68

Answers (2)

RedHat5
RedHat5

Reputation: 30

if you are using Xampp check your project folder in your htaccess file you have to set RewriteBase to your folder name

RewriteBase /YOUR_PROJECT/

check your config file in application/config/config.php

$config['base_url']  =  "http://".$_SERVER['HTTP_HOST'];
$config['base_url'] .= preg_replace('@/+$@', '', dirname($_SERVER['SCRIPT_NAME'])).'/';

check route file in application/config/route.php

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

Upvotes: 0

Alain
Alain

Reputation: 31

Try with this in .htaccess and config

RewriteEngine On

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


$config['base_url'] = '';
$config['index_page'] = '';

or

$config['base_url'] = 'put-here-your-local-ip';
$config['index_page'] = '';

Upvotes: 0

Related Questions