CI in the default rewrite URL is similar to this
For example your CI root directory is under /codeigniter/ , your below level two URL is similar to this http://localhost/CodeIgniter/index.php/welcome.
Not too good-looking, how to take out the index.php?
Here's how to fix it:
The first step:
Apache Url Rewrite Configuration (php pseudo-static)
Check if the following code exists in conf/httpd.conf in Apache:
#LoadModule Rewrite_module modules/mod_rewrite.so
Remove the # from the front of the loadmodule.
Step Two:
Add. htaccess (and application, system in one directory) at the site root.
The contents are:
Rewriteengine on rewritecond $!^ (index\.php|images|robots\.txt) rewriterule ^ (. *) $/index.php/$1 [L]
Note:
1, pay attention to/index.php/$1 according to your directory (Web directory, such as http://www.domain.com/index.php) the actual situation to be determined.
For example, the site root directory is/ci/index.php to write/ci/index.php/$1
2. Rewritecond $!^ (index\.php|images|robots\.txt)
The above code means to exclude certain directories or files, so that these directories will not be rewrite to index.php, which is generally used in pictures, JS, CSS and other external resources. This means that non-PHP code should be excluded. (Here I ruled out the images directory and the robots.txt file, of course index.php should also be excluded)
Step Three:
Modify application/config.php
Find $config[' index_page '] = "index.php";
Modified to: $config [' index_page '] = "";
Fourth Step:
In the httpd.conf file:
AllowOverride None
Switch
AllowOverride All
Note: If you do a virtual site, do a multisite configuration in httpd-vhosts.conf, just like me:
<virtualhost *:81> documentroot "D:/wamp/www/nxtv" ServerName bayi <directory "D:/WAMP/WWW/NXTV" > Options followsymlinks allowoverride all Require all granted </Directory></VirtualHost>< VirtualHost *:82> documentroot "d:/wamp/www/codeigniter220" ServerName localhost:82 <directory "d:/wamp/www/ codeigniter220 "> Options followsymlinks allowoverride all Require all granted </Directory>
Remember to change allowoverride None to allowoverride all, I'm here to suffer. =
Remove index.php from the default URL of the PHP framework CI