The default rewrite URL of CI is similar to this. For example, your CI root directory is under /CodeIgniter/, and your secondary URL below is similar to http://localhost/CodeIgniter/index.php/welcome. It doesn’t look good. How can I remove the index.php in it?
1. Open the apache configuration file, conf/httpd.conf:
LoadModule rewrite_module modules/mod_rewrite.so, and remove the # before the line.
Search for AllowOverride None (there are many places in the configuration file), look at the comment information, and change the line information in the relevant .htaccess to AllowOverride All.
2. In the root directory of CI, that is, in the directory at the same level as index.php and system, create .htaccess. Directly creating the file name will not succeed. You can create Notepad first. file, just save it as a file with this name. The content is as follows (also introduced in the CI manual):
Copy code The code is as follows:
RewriteEngine on
RewriteCond $1 !^(index.php|images|robots.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
If the file is not at the root of www directory, for example mine is: http://www.nowamagic.net/CodeIgniter/, the third line needs to be rewritten as RewriteRule ^(.*)$ /CodeIgniter/index.php/$1 [L].
In addition, there are js folders and css folders in the same directory of my index.php. These need to be filtered and removed. The second line needs to be rewritten as: RewriteCond $1 !^(index.php|images|js| css|robots.txt)
3. Change $config['index_page'] = "index.php"; in the CI configuration file (system/application/config/config.php) config['index_page'] = ""; .
Copy code The code is as follows:
/*
|--------- -------------------------------------------------- ---------------
| Index File
|------------------------- --------------------------------------------------
| Typically this will be your index.php file, unless you've renamed it to
| something else. If you are using mod_rewrite to remove the page set this
| variable so that it is blank.
*/
$config['index_page'] = '';
Restart apache
http://www.bkjia.com/PHPjc/327910.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/327910.htmlTechArticleThe default rewrite url of CI is similar to this. For example, your CI root directory is under /CodeIgniter/, Your secondary URL below is similar to http://localhost/CodeIgniter/index.php/welcome. No...