title: Remove and Redirect index.php from CodeIgniter
body: <p>I got an old project and it has some bizarre issue. Its CodeIgniter project (version 2.X).</p>
  
  <p>Google is indexing our URLs with index.php?. Below is an example</p>
  
  <pre><code>https://www.website.com/index.php?/my-seo-friendly-uri
  </code></pre>
  
  <p>I can see my pages from above url and with 2 more variants as below</p>
  
  <pre><code>https://www.website.com/index.php/my-seo-friendly-uri
  
  https://www.website.com/my-seo-friendly-uri
  </code></pre>
  
  <p>We have used <code>https://www.website.com/my-seo-friendly-uri</code> throughout the site.</p>
  
  <p>My question is how I can redirect <code>https://www.website.com/index.php?/my-seo-friendly-uri</code> and <code>https://www.website.com/index.php/my-seo-friendly-uri</code> to <code>https://www.website.com/my-seo-friendly-uri</code>?</p>
  
  <p><strong>The thing I already did</strong></p>
  
  <pre><code>&lt;IfModule mod_rewrite.c&gt;
  RewriteEngine On
  RewriteRule ^index.php/(.*)$ /$1 [R=302,L]
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ index.php?/$1 [L] 
  &lt;/IfModule&gt;
  </code></pre>
  
  <p>This redirects <code>index.php</code> to normal URLs, but <code>index.php?</code> version of url is still not redirecting</p>
  
  <p>In my <code>config.php</code>, I have the following settings</p>
  
  <pre><code>$config['index_page'] = '';
  $config['uri_protocol'] = 'REQUEST_URI';
  </code></pre>