{"id":486,"date":"2013-02-17T20:45:00","date_gmt":"2013-02-17T13:45:00","guid":{"rendered":"http:\/\/nvntung.wordpress.com\/?p=486"},"modified":"2014-03-14T22:13:46","modified_gmt":"2014-03-14T15:13:46","slug":"remove-index-php-in-codeigniter","status":"publish","type":"post","link":"https:\/\/www.itersdesktop.com\/fr\/2013\/02\/17\/remove-index-php-in-codeigniter\/","title":{"rendered":"Remove index.php in Codeigniter"},"content":{"rendered":"<p>H\u00f4m nay \u0111\u1ecdc <a href=\"http:\/\/ulyssesonline.com\/2011\/12\/08\/remove-index-php-in-codeigniter\/\" target=\"_blank\">b\u00e0i n\u00e0y<\/a>, t\u00f4i th\u1ea5y quan tr\u1ecdng n\u00ean xin t\u00e1c gi\u1ea3 mang v\u1ec1 \u0111\u00e2y.<\/p>\n<p>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\u2019s an example of how the URL would look like with the index.php being visible.<\/p>\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_83 counter-hierarchy ez-toc-counter ez-toc-light-blue ez-toc-container-direction\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<label for=\"ez-toc-cssicon-toggle-item-6a0110d94908e\" class=\"ez-toc-cssicon-toggle-label\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/label><input type=\"checkbox\"  id=\"ez-toc-cssicon-toggle-item-6a0110d94908e\"  aria-label=\"Toggle\" \/><nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.itersdesktop.com\/fr\/2013\/02\/17\/remove-index-php-in-codeigniter\/#codeigniter-url\" >CodeIgniter URL<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.itersdesktop.com\/fr\/2013\/02\/17\/remove-index-php-in-codeigniter\/#htaccess\" >.htaccess<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.itersdesktop.com\/fr\/2013\/02\/17\/remove-index-php-in-codeigniter\/#configphp\" >config.php<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/www.itersdesktop.com\/fr\/2013\/02\/17\/remove-index-php-in-codeigniter\/#codeigniter-url-2\" >CodeIgniter URL<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/www.itersdesktop.com\/fr\/2013\/02\/17\/remove-index-php-in-codeigniter\/#htaccess-2\" >.htaccess<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/www.itersdesktop.com\/fr\/2013\/02\/17\/remove-index-php-in-codeigniter\/#configphp-2\" >config.php<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/www.itersdesktop.com\/fr\/2013\/02\/17\/remove-index-php-in-codeigniter\/#codeigniter-url-3\" >CodeIgniter URL<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/www.itersdesktop.com\/fr\/2013\/02\/17\/remove-index-php-in-codeigniter\/#htaccess-3\" >.htaccess<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/www.itersdesktop.com\/fr\/2013\/02\/17\/remove-index-php-in-codeigniter\/#configphp-3\" >config.php<\/a><\/li><\/ul><\/nav><\/div>\n<h3><span class=\"ez-toc-section\" id=\"codeigniter-url\"><\/span>CodeIgniter URL<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>http:\/\/example.com\/<var>index.php<\/var>\/news\/article\/my_article<\/p>\n<h3><span class=\"ez-toc-section\" id=\"htaccess\"><\/span>.htaccess<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>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.<\/p>\n<pre><ifmodule mod_rewrite.c>\r\nRewriteEngine On\r\nRewriteBase \/ci\/\r\n\r\nRewriteCond %{REQUEST_URI} ^system.*\r\nRewriteRule ^(.*)$ \/index.php?\/$1 [L]\r\n\r\nRewriteCond %{REQUEST_URI} ^application.*\r\nRewriteRule ^(.*)$ \/index.php?\/$1 [L]\r\n\r\nRewriteCond %{REQUEST_FILENAME} !-f\r\nRewriteCond %{REQUEST_FILENAME} !-d\r\nRewriteRule ^(.*)$ index.php?\/$1 [L]\r\n<\/ifmodule>\r\n\r\n<ifmodule !mod_rewrite.c>\r\nErrorDocument 404 \/index.php\r\n<\/ifmodule><\/pre>\n<h3><span class=\"ez-toc-section\" id=\"configphp\"><\/span>config.php<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>In addition, you will need to edit the \/application\/config\/config.php file. Make sure to remove index.php reference within the file.<\/p>\n<pre>$config['index_page'] = '';<\/pre>\n<p><\/p>","protected":false},"excerpt":{"rendered":"<p>H\u00f4m nay \u0111\u1ecdc b\u00e0i n\u00e0y, t\u00f4i th\u1ea5y quan tr\u1ecdng n\u00ean xin t\u00e1c gi\u1ea3 mang v\u1ec1 \u0111\u00e2y. If you work with CodeIgniter, you will soon learn fast enough that the CodeIgniter&hellip; <\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[52,89],"class_list":["post-486","post","type-post","status-publish","format-standard","hentry","category-web-engineering","tag-codeigniter","tag-php"],"_links":{"self":[{"href":"https:\/\/www.itersdesktop.com\/fr\/wp-json\/wp\/v2\/posts\/486","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.itersdesktop.com\/fr\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.itersdesktop.com\/fr\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.itersdesktop.com\/fr\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.itersdesktop.com\/fr\/wp-json\/wp\/v2\/comments?post=486"}],"version-history":[{"count":2,"href":"https:\/\/www.itersdesktop.com\/fr\/wp-json\/wp\/v2\/posts\/486\/revisions"}],"predecessor-version":[{"id":1407,"href":"https:\/\/www.itersdesktop.com\/fr\/wp-json\/wp\/v2\/posts\/486\/revisions\/1407"}],"wp:attachment":[{"href":"https:\/\/www.itersdesktop.com\/fr\/wp-json\/wp\/v2\/media?parent=486"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.itersdesktop.com\/fr\/wp-json\/wp\/v2\/categories?post=486"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.itersdesktop.com\/fr\/wp-json\/wp\/v2\/tags?post=486"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}