1

I am trying to remove index.php of my codeigitor application which is hosted on EC2 instance of ubuntu OS. But unable to get the solution.

Below is my htaccess file added to the root of my application

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

Thanks

prashant.fepale
  • 547
  • 1
  • 8
  • 26
  • 1
    Possible duplicate of [CodeIgniter removing index.php from url](http://stackoverflow.com/questions/19183311/codeigniter-removing-index-php-from-url) – Pacio Mar 24 '17 at 13:14
  • This needs to be fixed in the config.php settings- see this question: http://stackoverflow.com/questions/19183311/codeigniter-removing-index-php-from-url – Pacio Mar 24 '17 at 13:15

1 Answers1

0
  1. Add .htaccess file in you CI root folder and add this code

    <IfModule mod_rewrite.c>
    RewriteEngine On
    #RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [QSA,L]
    </IfModule>
    
  2. Remove idex.php from CI

    $config['base_url'] = ''; 
    $config['index_page'] = '';
    
  3. Then

    sudo nano /etc/apache2/apache2.conf
    

    and change:

    <Directory /var/www/>
    AllowOverride All
    
  4. Restart the apache

Stephen Rauch
  • 47,830
  • 31
  • 106
  • 135
rahul kumar
  • 135
  • 6