0

I came across this code for .htaccess:

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,QSA]

This is suppose to remove index.php from the link.

I have created the file under the view directory, however it doesn't work. Am I doing something wrong?

jleft
  • 3,457
  • 1
  • 23
  • 35
dtjmsy
  • 2,664
  • 9
  • 42
  • 62

1 Answers1

0

The .htaccess file should be in the root of your project, alonside the main index.php file. Example of directory structure and location of .htaccess (assumes that you haven't moved the location of you application or system directory):

 -public_html
    -index.php
    -.htaccess
    -application
    -system

In application/config/config.php, index.php should be removed from the index_page config:

$config['index_page'] = '';

You may also have to change the value of the uri_protocol config:

$config['uri_protocol'] = 'REQUEST_URI'; //(If this value doesn't work, try the others!)
jleft
  • 3,457
  • 1
  • 23
  • 35