How to remove index.php from codeigniter in Fast-cgi

Problems with mod_rewrite in the Fast-cgi environment for CodeIgniter. My .htaccess looks like this:

DirectoryIndex index.php RewriteEngine on RewriteCond $1 !^(index\\.php|images|css|js|robots\\.txt|favicon\\.ico) RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ /index.php?$1 [L] 

But I have the error "There is no input file.

I changed to

 RewriteEngine On RewriteCond %{REQUEST_FILENAME} -f [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^.* - [L] RewriteCond $1 !^(index\.php|images|robots\.txt) #RewriteRule ^(.*)$ /index.php?/$1 [QSA,L] <IfModule mod_php5.c> RewriteRule ^(.*)$ index.php/$1 [L] </IfModule> <IfModule !mod_php5.c> RewriteRule ^(.*)$ index.php?/$1 [L] </IfModule> 

It only works with this:

 #RewriteRule ^(.*)$ /index.php?/$1 [QSA,L] 

My problem is that I still have index.php on the URL if I changed the configuration file application / config / config.php from $ config ['index_page'] = 'index.php'; to $ config ['index_page'] = ''; I have a different error.

What am I doing wrong?

+5
source share
2 answers

add code to .htaccess

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

and modifying the config.php file

 $config['index_page'] = 'index.php'; 

to

 $config['index_page'] = ''; 
0
source

Add this code to your .htaccess file

 RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php/$1 [L] //find the below code $config['index_page'] = "index.php" //replace with the below code $config['index_page'] = "" 
0
source

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


All Articles