Remove index.php From URL - Codeigniter 2 Remove index.php From URL - Codeigniter 2 codeigniter codeigniter

Remove index.php From URL - Codeigniter 2


Try the first code block you posted, but instead of /index.php try using /(site)/index.php (obv replacing (site) with whatever your site folder is named).


This worked for me:

  1. Create your htaccess file
  2. Set $config[‘index_page’] to an empty (config.php)
  3. string Set $config['uri_protocol'] = 'REQUEST_URI'; (config.php)

This is my htaccess file:

Options -IndexesOptions +FollowSymLinks

RewriteEngine OnRewriteBase /#Removes access to the system folder by users.#Additionally this will allow you to create a System.php controller,RewriteCond %{REQUEST_URI} ^system.*RewriteRule ^(.*)$ index.php?/$1 [L]#When your application folder isn't in the system folderRewriteCond %{REQUEST_URI} ^application.*RewriteRule ^(.*)$ /index.php?/$1 [L]#Checks to see if the user is attempting to access a valid file,#such as an image or css document, if this isn't true it sends the#request to index.phpRewriteCond %{REQUEST_FILENAME} !-fRewriteCond %{REQUEST_FILENAME} !-dRewriteRule ^(.*)$ index.php?/$1 [L]

# If we don't have mod_rewrite installed, all 404's# can be sent to index.php, and everything works as normal.# Submitted by: ElliotHaughin   ErrorDocument 404 /index.php

Source:

http://taggedzi.com/articles/display/codeigniter-2-htaccess-and-friendly-urls


RewriteEngine OnRewriteCond %{REQUEST_FILENAME} !-fRewriteCond %{REQUEST_FILENAME} !-dRewriteRule ^(.*)$ index.php?/$1 [L]

This much is only required in root folder add this to .htaccess