I made a project with codeigniter 4.0.0 rc 3
On windows it works.
On Linux debian 10 not run.
in my .htaccess they have changed
in Config / app
I'm using php 7.3
I have enabled rewrite_module in Apache 2.
sudo a2enmod rewrite
After enabling mod_rewrite, I restarted the server
with the php function apache_get_modules () I print the list of modules. [27] => mod_rewrite.
in the browser http: //my_domain.loc/index.php default is it works.
click the buttons call MY_Controller
in my browser http: //my_domain.loc/MY_Controller is not working
Message:
NOT FOUND
The requested URL was not found on this server.
This only in Linux.
my conf host Apache 2
my .htaccess in the public folder
my .htaccess project folder
my index.php in pubblic folder
my index.php in project folder
On windows it works.
On Linux debian 10 not run.
in my .htaccess they have changed
Code:
RewriteRule ^(.*)$ index.php/$1 [L]
to
RewriteRule ^(.*)$ index.php?/$1 [L,QSA]
Code:
public $baseURL = 'http://my_domain.loc/';
public $indexPage = '';
public $uriProtocol = 'PATH_INFO';
I'm using php 7.3
I have enabled rewrite_module in Apache 2.
sudo a2enmod rewrite
After enabling mod_rewrite, I restarted the server
with the php function apache_get_modules () I print the list of modules. [27] => mod_rewrite.
in the browser http: //my_domain.loc/index.php default is it works.
click the buttons call MY_Controller
in my browser http: //my_domain.loc/MY_Controller is not working
Message:
NOT FOUND
The requested URL was not found on this server.
This only in Linux.
my conf host Apache 2
Code:
<VirtualHost *:80>
ServerAdmin [email protected]_domain.loc
ServerName my_domain.loc
ServerAlias www.my_domain.loc
DocumentRoot /var/www/my_domain.loc/html/my_domain_folder/public
ErrorLog ${APACHE_LOG_DIR}/my_domain.loc.error.log
CustomLog ${APACHE_LOG_DIR}/my_domain.loc.access.log combined
</VirtualHost>
my .htaccess in the public folder
PHP Code:
# Disable directory browsing
Options All -Indexes
# ----------------------------------------------------------------------
# Rewrite engine
# ----------------------------------------------------------------------
# Turning on the rewrite engine is necessary for the following rules and features.
# FollowSymLinks must be enabled for this to work.
<IfModule mod_rewrite.c>
Options +FollowSymlinks
RewriteEngine On
# If you installed CodeIgniter in a subfolder, you will need to
# change the following line to match the subfolder you need.
# http://httpd.apache.org/docs/current/mod/mod_rewrite.html#rewritebase
# RewriteBase /
# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Rewrite "www.example.com -> example.com"
RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^ http://%1%{REQUEST_URI} [R=301,L]
# Checks to see if the user is attempting to access a valid file,
# such as an image or css document, if this isn't true it sends the
# request to the front controller, index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L,QSA]
# Ensure Authorization header is passed along
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</IfModule>
<IfModule !mod_rewrite.c>
# If we don't have mod_rewrite installed, all 404's
# can be sent to index.php, and everything works as normal.
ErrorDocument 404 index.php
</IfModule>
# Disable server signature start
ServerSignature Off
# Disable server signature end
my .htaccess project folder
PHP Code:
# Disabilita la navigazione nella directory
Opzioni All -Indexes
# --------------- -------------------------------------------------- -----
# Riscrivi il motore
# --------------------- -------------------------------------------------
# L'attivazione del motore di riscrittura è necessaria per le seguenti regole e funzionalità.
# FollowSymLink deve essere abilitato affinché funzioni.
<IfModule mod_rewrite.c>
Opzioni + SeguiSymlink
RewriteEngine On
# Se hai installato CodeIgniter in una sottocartella, dovrai
# cambiare la seguente riga in modo che corrisponda alla sottocartella di cui hai bisogno.
# http://httpd.apache.org/docs/current/mod/mod_rewrite.html#rewritebase
# RewriteBase /
# Reindirizza le barre finali ...
RewriteRule ^ (. *) / $ / $ 1 [L, R = 301]
# Riscrivi "www.example.com -> example.com "
RewriteCond% {HTTPS}! = on [/ color]
RewriteCond% {HTTP_HOST} ^ www \. (. +) $ [NC]
RewriteRule ^ http: //% 1% {REQUEST_URI} [R = 301, L]
# Verifica se l'utente sta tentando di accedere a un file valido,
# come un'immagine o un documento CSS, se questo non è vero, invia il
# richiesta al front controller, index.php
RewriteCond% {REQUEST_FILENAME}! -f
RewriteCond% { REQUEST_FILENAME}! -D
RewriteRule ^ (. *) $ Index.php? / $ 1 [L, QSA]
#inserito per xdebug [/ color ]
RewriteCond% {HTTP_COOKIE}! XDEBUG_SESSION [NC]
RewriteRule ^ (. *) $ $ 1? XDEBUG_SESSION_START = mod_rewrite [QSA, L]
# Assicurati che l'intestazione dell'autorizzazione sia passata lungo
RewriteCond% {HTTP: Authorization}.
RewriteRule. * - [E = HTTP_AUTHORIZATION: % {HTTP: Autorizzazione}]
</IfModule>
<IfModule! Mod_rewrite.c>
# If non abbiamo installato mod_rewrite, tutti i 404
# possono essere inviati a index.php e tutto funziona normalmente.
ErrorDocument 404 index.php
</IfModule>
# Disabilita avvio firma server
ServerSignature Off
# Disabilita la fine della firma del server
my index.php in pubblic folder
PHP Code:
<?php
// Valid PHP Version?
$minPHPVersion = '7.2';
if (phpversion() < $minPHPVersion)
{
die("Your PHP version must be {$minPHPVersion} or higher to run CodeIgniter. Current version: " . phpversion());
}
unset($minPHPVersion);
// Path to the front controller (this file)
define('FCPATH', __DIR__ . DIRECTORY_SEPARATOR);
// Location of the Paths config file.
// This is the line that might need to be changed, depending on your folder structure.
$pathsPath = FCPATH . '../app/Config/Paths.php';
// ^^^ Change this if you move your application folder
/*
*---------------------------------------------------------------
* BOOTSTRAP THE APPLICATION
*---------------------------------------------------------------
* This process sets up the path constants, loads and registers
* our autoloader, along with Composer's, loads our constants
* and fires up an environment-specific bootstrapping.
*/
// Ensure the current directory is pointing to the front controller's directory
chdir(__DIR__);
// Load our paths config file
require $pathsPath;
$paths = new Config\Paths();
// Location of the framework bootstrap file.
$app = require rtrim($paths->systemDirectory, '/ ') . '/bootstrap.php';
/*
*---------------------------------------------------------------
* LAUNCH THE APPLICATION
*---------------------------------------------------------------
* Now that everything is setup, it's time to actually fire
* up the engines and make this app do its thang.
*/
$app->run();
my index.php in project folder
PHP Code:
<?php
// Valid PHP Version?
$minPHPVersion = '7.2';
if (phpversion() < $minPHPVersion)
{
die("Your PHP version must be {$minPHPVersion} or higher to run CodeIgniter. Current version: " . phpversion());
}
unset($minPHPVersion);
// Path to the front controller (this file)
define('FCPATH', __DIR__ . DIRECTORY_SEPARATOR);
// Location of the Paths config file.
// This is the line that might need to be changed, depending on your folder structure.
$pathsPath = FCPATH . 'app/Config/Paths.php';
// ^^^ Change this if you move your application folder
/*
*---------------------------------------------------------------
* BOOTSTRAP THE APPLICATION
*---------------------------------------------------------------
* This process sets up the path constants, loads and registers
* our autoloader, along with Composer's, loads our constants
* and fires up an environment-specific bootstrapping.
*/
// Ensure the current directory is pointing to the front controller's directory
chdir(__DIR__);
// Load our paths config file
require $pathsPath;
$paths = new Config\Paths();
// Location of the framework bootstrap file.
$app = require rtrim($paths->systemDirectory, '/ ') . '/bootstrap.php';
/*
*---------------------------------------------------------------
* LAUNCH THE APPLICATION
*---------------------------------------------------------------
* Now that everything is setup, it's time to actually fire
* up the engines and make this app do its thang.
*/
$app->run();