5

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 ?

1
  • 3
    I found the solution on the application/config/config.php, I changed $config['uri_protocol'] = 'AUTO'; to $config['uri_protocol'] = 'REQUEST_URI'; Commented Oct 6, 2014 at 16:39

3 Answers 3

1

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'] = '';
Sign up to request clarification or add additional context in comments.

Comments

0

Add this code in .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'] = ""

Comments

0

Add this code in .htaccess file, notice the question mark behind index.php, that's the trick.

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

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

find the below code in config.php

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

replace with the below code

$config['index_page'] = ""

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.