The default URL rule for the CI framework is the entry file with the app, for example:
Example. COM/index. PHP/News/article/my_article
In the above URL with the portal file index.php, such a URL rule is not friendly to the search engine, then how to remove the index.php it?
Apache Environment:
Use the. htaccess file to set some simple rules to remove it. The following is an example of using the "negative" method to redirect non-specified content:
Rewriteengine onrewritecond!^ (index\.php| Images| Robots\.txt)rewriterule^ (. *)/index. PHP/[L]
If your project is not in the root directory, please change the above sentence to read:
Rewriterule^ (. *)$ index. PHP/[L]
In the above example, any HTTP requests that can implement any non-index.php, images, and robots.txt are directed to index.php.
Nginx Environment:
Modify the Nginx configuration file and add the following code to the server segment:
Location/{
Index index.php INDEX.HML index.htmIf (-f $request _filename/index.php) { rewrite (. *) $1/index.php ; } if (!- E $request _filename { rewrite (. *)/index.; }} /span>
Remove index.php from the CI framework URL under nginx