The CI default rewrite URL is similar to this, for example, your CI root directory is under/codeigniter/, and your below level two URL is similar to this http://localhost/CodeIgniter/index.php/welcome. Not very good-looking, how to take out the index.php?
1. Open the Apache configuration file, conf/httpd.conf:
LoadModule rewrite_module modules/mod_rewrite.so, remove the line before it.
Search AllowOverride None (there are multiple places in the configuration file), look at the annotation information, and change the line information for the related. htaccess to allowoverride all.
2. In the root of CI, that is, in the index.php,system of the same directory, the establishment of. Htaccess, the direct establishment of the file name will not succeed, you can create a Notepad file, save as a file of that name. The content is as follows (also described in the CI Handbook):
Copy Code code as follows:
Rewriteengine on
Rewritecond $!^ (index\.php|images|robots\.txt)
Rewriterule ^ (. *) $/index.php/$1 [L]
If the file is not in the WWW root directory, such as mine is: http://www.nowamagic.net/CodeIgniter/, the third line needs to be rewritten as Rewriterule ^ (. *) $/codeigniter/index.php/$1 [L].
In addition, my index.php also have JS folder and CSS folder under the same directory, which need to filter out, the second line needs to be rewritten as: Rewritecond $!^ (index\.php|images|js|css|robots\.txt)
3. $config[' Index_page ' in the configuration file in Ci (system/application/config/config.php) = "index.php"; $config[' index_page '] = ""; 。
Copy Code code as follows:
/*
|--------------------------------------------------------------------------
| Index File
|--------------------------------------------------------------------------
| Typically this'll be your index.php file, unless your ' ve renamed it to
| Something else. If you are are using Mod_rewrite to remove the page set this
| Variable So, it is blank.
*/
$config [' index_page '] = ';
Restart Apache