{"id":102,"date":"2013-05-26T13:30:40","date_gmt":"2013-05-26T13:30:40","guid":{"rendered":"https:\/\/www.joetannorella.com\/?p=102"},"modified":"2013-05-26T13:30:40","modified_gmt":"2013-05-26T13:30:40","slug":"how-to-remove-index-php-from-codeigniter-urls","status":"publish","type":"post","link":"https:\/\/www.joetannorella.com\/how-to-remove-index-php-from-codeigniter-urls\/","title":{"rendered":"How to remove index.php from Codeigniter URLs"},"content":{"rendered":"

Codeigniter<\/a> is an awesome PHP framework that makes PHP development much simpler, and much much faster. I’ve only been getting to grips with it for a few days, but have noticed there are some quirks that come packaged that you’re going to want to get rid of. One of these is the fact that ‘index.php’ is present in all URLs as standard.<\/p>\n

It’s not difficult to fix this issue.<\/p>\n

Step 1<\/strong><\/p>\n

Go to \/application\/config\/config.php\/ <\/em>and change the following line:<\/p>\n

$config['index_page'] = 'index.php';<\/pre>\n

to<\/p>\n

$config['index_page'] = '';<\/pre>\n

As in the screenshot below (I’m using Sublime Text 2 in case anyone is wondering):<\/p>\n

\"codeigniter-indexphp\"<\/a><\/p>\n

 <\/p>\n

Step 2<\/strong><\/p>\n

Now make sure you have a .htaccess file in the Codeigniter root. Note that as standard, the .htaccess file comes in the \/application\/ directory… You need to move the .htaccess file up a directory for it to work.<\/p>\n

Step 3<\/strong><\/p>\n

Add the following to the .htaccess file:<\/p>\n

RewriteEngine On\nRewriteCond %{REQUEST_FILENAME} !-f\nRewriteCond %{REQUEST_FILENAME} !-d\nRewriteRule ^(.*)$ index.php\/$1 [L]<\/pre>\n

 <\/p>\n","protected":false},"excerpt":{"rendered":"

Codeigniter is an awesome PHP framework that makes PHP development much simpler, and much much faster. I’ve only been getting to grips with it for a few days, but have noticed there are some quirks that come packaged that you’re going to want to get rid of. One of these is the fact that ‘index.php’…<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[7],"tags":[10],"yoast_head":"\nHow to remove index.php from Codeigniter URLs - JoeTannorella.com<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.joetannorella.com\/how-to-remove-index-php-from-codeigniter-urls\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to remove index.php from Codeigniter URLs - JoeTannorella.com\" \/>\n<meta property=\"og:description\" content=\"Codeigniter is an awesome PHP framework that makes PHP development much simpler, and much much faster. I’ve only been getting to grips with it for a few days, but have noticed there are some quirks that come packaged that you’re going to want to get rid of. One of these is the fact that ‘index.php’...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.joetannorella.com\/how-to-remove-index-php-from-codeigniter-urls\/\" \/>\n<meta property=\"og:site_name\" content=\"JoeTannorella.com\" \/>\n<meta property=\"article:published_time\" content=\"2013-05-26T13:30:40+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.joetannorella.com\/wp-content\/uploads\/2013\/05\/codeigniter-indexphp.png\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.joetannorella.com\/how-to-remove-index-php-from-codeigniter-urls\/\",\"url\":\"https:\/\/www.joetannorella.com\/how-to-remove-index-php-from-codeigniter-urls\/\",\"name\":\"How to remove index.php from Codeigniter URLs - JoeTannorella.com\",\"isPartOf\":{\"@id\":\"https:\/\/www.joetannorella.com\/#website\"},\"datePublished\":\"2013-05-26T13:30:40+00:00\",\"dateModified\":\"2013-05-26T13:30:40+00:00\",\"author\":{\"@id\":\"https:\/\/www.joetannorella.com\/#\/schema\/person\/84eafed4ad6cd6934b006e371c06c7ae\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.joetannorella.com\/how-to-remove-index-php-from-codeigniter-urls\/\"]}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.joetannorella.com\/#website\",\"url\":\"https:\/\/www.joetannorella.com\/\",\"name\":\"JoeTannorella.com\",\"description\":\"Web Development | Digital Marketing | Business\/Startups | Analytics\/data\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.joetannorella.com\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.joetannorella.com\/#\/schema\/person\/84eafed4ad6cd6934b006e371c06c7ae\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.joetannorella.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/257001162d06da1a465f242dfa80dd7b?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/257001162d06da1a465f242dfa80dd7b?s=96&d=mm&r=g\",\"caption\":\"admin\"},\"url\":\"https:\/\/www.joetannorella.com\/author\/admin\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to remove index.php from Codeigniter URLs - JoeTannorella.com","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.joetannorella.com\/how-to-remove-index-php-from-codeigniter-urls\/","og_locale":"en_US","og_type":"article","og_title":"How to remove index.php from Codeigniter URLs - JoeTannorella.com","og_description":"Codeigniter is an awesome PHP framework that makes PHP development much simpler, and much much faster. I’ve only been getting to grips with it for a few days, but have noticed there are some quirks that come packaged that you’re going to want to get rid of. One of these is the fact that ‘index.php’...","og_url":"https:\/\/www.joetannorella.com\/how-to-remove-index-php-from-codeigniter-urls\/","og_site_name":"JoeTannorella.com","article_published_time":"2013-05-26T13:30:40+00:00","og_image":[{"url":"https:\/\/www.joetannorella.com\/wp-content\/uploads\/2013\/05\/codeigniter-indexphp.png"}],"author":"admin","twitter_misc":{"Written by":"admin","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.joetannorella.com\/how-to-remove-index-php-from-codeigniter-urls\/","url":"https:\/\/www.joetannorella.com\/how-to-remove-index-php-from-codeigniter-urls\/","name":"How to remove index.php from Codeigniter URLs - JoeTannorella.com","isPartOf":{"@id":"https:\/\/www.joetannorella.com\/#website"},"datePublished":"2013-05-26T13:30:40+00:00","dateModified":"2013-05-26T13:30:40+00:00","author":{"@id":"https:\/\/www.joetannorella.com\/#\/schema\/person\/84eafed4ad6cd6934b006e371c06c7ae"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.joetannorella.com\/how-to-remove-index-php-from-codeigniter-urls\/"]}]},{"@type":"WebSite","@id":"https:\/\/www.joetannorella.com\/#website","url":"https:\/\/www.joetannorella.com\/","name":"JoeTannorella.com","description":"Web Development | Digital Marketing | Business\/Startups | Analytics\/data","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.joetannorella.com\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.joetannorella.com\/#\/schema\/person\/84eafed4ad6cd6934b006e371c06c7ae","name":"admin","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.joetannorella.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/257001162d06da1a465f242dfa80dd7b?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/257001162d06da1a465f242dfa80dd7b?s=96&d=mm&r=g","caption":"admin"},"url":"https:\/\/www.joetannorella.com\/author\/admin\/"}]}},"_links":{"self":[{"href":"https:\/\/www.joetannorella.com\/wp-json\/wp\/v2\/posts\/102"}],"collection":[{"href":"https:\/\/www.joetannorella.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.joetannorella.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.joetannorella.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.joetannorella.com\/wp-json\/wp\/v2\/comments?post=102"}],"version-history":[{"count":0,"href":"https:\/\/www.joetannorella.com\/wp-json\/wp\/v2\/posts\/102\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.joetannorella.com\/wp-json\/wp\/v2\/media?parent=102"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.joetannorella.com\/wp-json\/wp\/v2\/categories?post=102"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.joetannorella.com\/wp-json\/wp\/v2\/tags?post=102"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}