Home / Công nghệ Web / Remove index.php in Codeigniter

Remove index.php in Codeigniter

Print Friendly, PDF & Email

Hôm nay đọc bài này, tôi thấy quan trọng nên xin tác giả mang về đây.

If you work with CodeIgniter, you will soon learn fast enough that the CodeIgniter framework, by default, uses the index.php in its URL. Here’s an example of how the URL would look like with the index.php being visible.

CodeIgniter URL

http://example.com/index.php/news/article/my_article

.htaccess

To remove the index.php from the URL, you will need to add mod rewrite rules to the .htaccess file in your main CodeIgniter directory. Use this code. Change the rewrite base to your own settings.

config.php

In addition, you will need to edit the /application/config/config.php file. Make sure to remove index.php reference within the file.

comments

About Nguyen Vu Ngoc Tung

I love making new professional acquaintances. Don't hesitate to contact me via nguyenvungoctung@gmail.com if you want to talk about information technology, education, and research on complex networks analysis (i.e., metabolic networks analysis), data analysis, and applications of graph theory. Specialties: researching and proposing innovative business approaches to organizations, evaluating and consulting about usability engineering, training and employee development, web technologies, software architecture.