Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

537
Visualizações
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 Respostas
Responde à pergunta

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 Relatório

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 Relatório

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda