Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

532
Views
codeigniter 3 - remove index.php : error 404 on linux but work fine on windows

Error 404 on linux but work fine on windows. What is causing this?

I use this tutorial: http://www.tutora.fr/apprendre-codeigniter/les-controleurs

application/config/routes.php :

$route['default_controller'] = 'welcome';
$route['translate_uri_dashes']  = FALSE;
$route['login'] = 'user_authentification/user_authentification';

application/config/config.php:

$config['base_url'] = '';
$config['index_page'] = '';
$config['uri_protocol'] = 'REQUEST_URI';
$config['subclass_prefix'] = 'CORE_';

Local hosting on Windows (XAMPP) works fine at url mysite.dev/login.

Live hosting on Linux produces 404 error at url mysite.pro/login.

If I add index.php (mysite.pro/index.php/login), it work fine but I would remove it.

over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

Create .htaccess file in project root directory if other .htaccess file is not already created.

copy paste below codes into it .

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /projectname
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
</IfModule>

You can try this link http://addictors.in/remove-index-php-from-url-in-codeigniter/

don't forget to restart your server

Hope it helps.

over 4 years ago · Santiago Trujillo Report

0

Linux is case sensitive. Keep in mind in which case you wrote the directory and file name. You should write file or directory name in any file exactly same what file or directory belongs.

Please check the file/directory of user_authentification. Moreover, the first letter of controller/model should be caps (codeigniter requirements). Please check did you write controller/model name correctly.

Update

Put the following snippets on .htaccess file:

<IfModule mod_rewrite.c>
   RewriteEngine on
   RewriteCond $1 !^(index\.php|resources|robots\.txt)
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteCond %{REQUEST_FILENAME} !-d
   RewriteRule ^(.*)$ index.php/$1 [L,QSA]
</IfModule>
over 4 years ago · Santiago Trujillo Report

0

The administrator has found the error. There was an error in virtual host.
The .htaccess file was never executed.
Thank you all for your help.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!