CodeIgniter Forums
Codeigniter3 EC2 remove index.php - Printable Version

+- CodeIgniter Forums (
+-- Forum: Using CodeIgniter (
+--- Forum: General Help (
+--- Thread: Codeigniter3 EC2 remove index.php (/showthread.php?tid=69335)

Codeigniter3 EC2 remove index.php - majortom84 - 11-06-2017

I have an EC2 instance running Ubuntu 16.04. I have installed a LAMP stack and am using Codeigniter.
the removal of index.php is not working as it should. I can reach the first page but if I click on any links in the page it does not work.
I have tried to follow the directions here: CodeIgniter removing index.php from url but, It has not helped

I have tried to edit the apache2.conf to allow override but this gives an error all the time.

I have tried almost every post online.

.htaccess file: (original)
RewriteCond $1 !^(index\.php|assets|images|js|css|uploads|favicon.png)
RewriteCond %(REQUEST_FILENAME) !-f
RewriteCond %(REQUEST_FILENAME) !-d
RewriteRule ^(.*)$ index.php?/$1 [L,QSA]

$config['index_page'] = '';
$config['uri_protocol']    = 'REQUEST_URI';

<li><a href="<?php echo base_url(); ?>">Home</a></li>
       <li><a href="<?php echo base_url(); ?>about">About</a></li>
       <li><a href="<?php echo base_url(); ?>pricing">Pricing</a></li>

RE: Codeigniter3 EC2 remove index.php - enlivenapp - 11-06-2017

I'd suggest using `base_url` only on the home link.   unless you've added it to your base_url in config.php you might not have a trailing slash the way you have it written. (You should have a trailing slash, but not everyone does it.)

Try site_url() and have the link URI inside the () thusly:

PHP Code:
<li><a href="<?php echo base_url(); ?>pricing">Pricing</a></li // old 
// I suspect you're getting http://example.compricing

// try this
<li><a href="<?php echo site_url('pricing'); ?>">Pricing</a></li
// should give you or in your browser address bar depending on config.php -> $config['index_page'] =... 

Lastly, are you *sure* rewrite is enabled?