Remove the index.php from the CodeIgniter address
Version: codeigniter_2.0.1
You want the URL for the CI app to not contain index.php
Example: http://www.example.com/index.php/product/712
Hope to become this http://www.example.com/product/712
So the URL is more beautiful, perhaps this seo more friendly, through Urlrewrite can achieve
Just use the following 3 steps to get it done:
1. Create the. htaccess write rewrite rules as follows
[Code]
??? Rewriteengine on
??? Rewritebase/
??? #Removes access to the system, folder by users.
??? #Additionally this would allow you to create a system.php controller,
??? #previously this would not has been possible.
??? # ' system ' can is replaced if you have renamed your system folder.
??? Rewritecond%{request_uri} ^system.*
??? Rewriterule ^ (. *) $/index.php?/$1 [L]
???
??? #When your application folder isn ' t in the System folder
??? #This snippet prevents user access to the application folder
??? #Submitted By:fabdrol
??? #Rename ' application ' to your Applications folder name.
??? Rewritecond%{request_uri} ^application.*
??? Rewriterule ^ (. *) $/index.php?/$1 [L]
??? #Checks to see if the user are attempting to access a valid file,
??? #such as an image or CSS document, if this isn ' t true it sends the
??? #request to index.php
??? Rewritecond%{request_filename}!-f
??? Rewritecond%{request_filename}!-d
??? Rewriterule ^ (. *) $ index.php?/$1 [L]
??? # If We don ' t have Mod_rewrite installed, all 404 ' s
??? # can is sent to index.php, and everything works as normal.
??? # submitted By:elliothaughin
??? ErrorDocument 404/index.php
?
[/code]
2. Set $config[' Index_page ' to be vacant
Open the file system/application/config/config.php the code
[PHP] $config [' index_page '] = "index.php"; [/php]
Switch
[PHP] $config [' index_page '] = '; [/php]
3. Make sure Apache supports URL rewriting and restarts Apache