Codeigniter 3 - remove index.php: 404 error on linux, but works fine on windows

Error 404 on linux, but works fine in windows. What causes this?

I am using 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_';

Localhosting in Windows (XAMPP) works fine in the url mysite.dev/login.

Live hosting on Linux generates a 404 error in the url mysite.pro/login.

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

+4
source share
3 answers

.htaccess , .htaccess .

.

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

http://addictors.in/remove-index-php-from-url-in-codeigniter/

, .

0

Linux . , . , .

, / user_authentification. , / ( ). , controller/model.

.htaccess:

<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>
0

. .
.htaccess .
.

0

Source: https://habr.com/ru/post/1629140/


All Articles