0
votes

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.

2
so I decided to try it on new project (that have only welcome page) and it works by adding .htacess file that what make me confuseabdulrahman mohammed
Add this piece of information to a new answer instead of a comment and set it as the "accepted answer" by ticking it.txemsukr
The problem still not solved yet, because it worked for me when I start new project folder, but still has the same issue in the one that I working onabdulrahman mohammed

2 Answers

0
votes

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'] = '';
0
votes

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';