1

Hi following are the changes I have made to remove index.php from URL

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

to $config['index_page'] = ""

then replace $config['uri_protocol'] ="AUTO"

by $config['uri_protocol'] = "REQUEST_URI"

then I added below code in .htaccess file

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

but this isn't working. Any Idea, what is wrong ?

1

4 Answers 4

3

You don't have to edit index.php, replace the content .htaccess file to:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
Sign up to request clarification or add additional context in comments.

5 Comments

and also if it does not work, try to put it in all htaccess file on your project :)
thanks,i have tried this but not working for me. i have updated config.php not index.php.... also waht do you mean by "try to put it in all htaccess file on your project"
on my project, i have ht access on outside the application folder, and inside application folder. how come it is not working? what's the error?
rules works but i made silly mistake. i just missed .(dot) in .htaccess file name:(
not working for me too... only logout got this problem
0

Please try using following code.

RewriteEngine On
RewriteCond %{REQUEST_URI}::$1 ^(.*?/)(.*)::\2$
RewriteRule ^(.*)$ - [E=BASE:%1]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L]

Comments

0

I dont know but i think the last thing you need to do is on your Apache. httpd.conf

Change

AllowOverride None

To

AllowOverride All

Also may i know where your .htaccess is located?

Comments

0

Place the .htaccess file in the project folder like this:

htdocs/your_project/.htaccess

Try this new code for .htaccess:

  <IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php/$1 [L,QSA]
  </IfModule>

Don't try to delete the other .htaccess file that is already in your application folder.

Changes in config.php are as follows:

$config['base_url'] = 'http://localhost/your_project_name/';
$config['index_page'] = '';
$config['uri_protocol'] = 'REQUEST_URI';

Don't use:

$config['uri_protocol'] ="AUTO"

Hope it will perfectly work fine for you.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.