Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Having problems with mod_rewrite in 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 got an error ‘No input file specified’.

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 works only with this one also :

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

My problem is that I still have the 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 I do wrong ?

like image 817
nandoC Avatar asked Nov 10 '22 00:11

nandoC


1 Answers

add the code in .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 config.php file change

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

to

$config['index_page'] = '';
like image 168
vallapureddy Karunakar Reddy Avatar answered Dec 01 '22 09:12

vallapureddy Karunakar Reddy