{"id":1517,"date":"2017-05-24T16:31:01","date_gmt":"2017-05-24T11:01:01","guid":{"rendered":"https:\/\/pheonixsolutions.com\/blog\/?p=1517"},"modified":"2026-08-21T16:00:04","modified_gmt":"2026-08-21T10:30:04","slug":"use-sub-folder-default-controller-route-codeigniter-3","status":"publish","type":"post","link":"https:\/\/pheonixsolutions.com\/blog\/use-sub-folder-default-controller-route-codeigniter-3\/","title":{"rendered":"How To Use a Subfolder in Default Controller Route In Codeigniter 3"},"content":{"rendered":"<h2>Introduction<\/h2>\n<p class=\"isSelectedEnd\">CodeIgniter 3 provides a simple routing mechanism for defining the default controller of an application. By default, the controller is generally placed directly inside the <code dir=\"ltr\">controllers<\/code> directory.<\/p>\n<p class=\"isSelectedEnd\">In some applications, controllers are organized into subfolders to maintain a better project structure. In this guide, we will explain how to configure CodeIgniter 3 to use a controller located inside a subfolder as the default controller by making a few changes to the router configuration.<\/p>\n<div contenteditable=\"false\">\n<hr \/>\n<\/div>\n<h2>Prerequisites<\/h2>\n<p class=\"isSelectedEnd\">Before making these changes, make sure you have:<\/p>\n<ul data-spread=\"false\">\n<li>A working CodeIgniter 3 application.<\/li>\n<li>Basic knowledge of PHP and CodeIgniter.<\/li>\n<li>Access to the CodeIgniter application files.<\/li>\n<li>Access to the <code dir=\"ltr\">system\/core\/Router.php<\/code> file.<\/li>\n<li>A controller placed inside a subfolder under the <code dir=\"ltr\">controllers<\/code> directory.<\/li>\n<\/ul>\n<div contenteditable=\"false\">\n<hr \/>\n<\/div>\n<h2>Implementation<\/h2>\n<h3>Step 1: Open the Router.php File<\/h3>\n<p class=\"isSelectedEnd\">Open the following file in your CodeIgniter 3 application:<\/p>\n<pre dir=\"ltr\"><code dir=\"ltr\">system\/core\/Router.php<\/code><\/pre>\n<p class=\"isSelectedEnd\">The changes need to be made in the section that handles the default controller.<br \/>\n<a href=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2017\/05\/Capture.png\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-1518 aligncenter\" src=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2017\/05\/Capture-300x139.png\" alt=\"\" width=\"710\" height=\"329\" srcset=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2017\/05\/Capture-300x139.png 300w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2017\/05\/Capture-768x356.png 768w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2017\/05\/Capture-50x23.png 50w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2017\/05\/Capture.png 821w\" sizes=\"auto, (max-width: 710px) 100vw, 710px\" \/><\/a><\/p>\n<div contenteditable=\"false\">\n<hr \/>\n<\/div>\n<h3>Step 2: Update the Default Controller Parsing<\/h3>\n<p class=\"isSelectedEnd\">Locate the following code around line 298:<\/p>\n<pre dir=\"ltr\"><code dir=\"ltr\">if (sscanf($this-&gt;default_controller, '%<span class=\"text-token-text-primary cursor-text rounded-sm\" data-placeholder-token=\"true\">[^\/]<\/span>\/%s', $class, $method) !== 2)<\/code><\/pre>\n<p class=\"isSelectedEnd\">Replace it with:<\/p>\n<pre dir=\"ltr\"><code dir=\"ltr\">if (sscanf($this-&gt;default_controller, '%<span class=\"text-token-text-primary cursor-text rounded-sm\" data-placeholder-token=\"true\">[^\/]<\/span>\/%<span class=\"text-token-text-primary cursor-text rounded-sm\" data-placeholder-token=\"true\">[^\/]<\/span>\/%s', $directory, $class, $method) !== 3)<\/code><\/pre>\n<p class=\"isSelectedEnd\">This allows the default controller route to contain three parts:<\/p>\n<ul data-spread=\"false\">\n<li><code dir=\"ltr\">$directory<\/code> \u2013 The controller subfolder.<\/li>\n<li><code dir=\"ltr\">$class<\/code> \u2013 The controller class.<\/li>\n<li><code dir=\"ltr\">$method<\/code> \u2013 The controller method.<\/li>\n<\/ul>\n<p class=\"isSelectedEnd\">For example:<\/p>\n<pre dir=\"ltr\"><code dir=\"ltr\">admin\/welcome\/index<\/code><\/pre>\n<p class=\"isSelectedEnd\">Here, <code dir=\"ltr\">admin<\/code> is the directory, <code dir=\"ltr\">welcome<\/code> is the controller, and <code dir=\"ltr\">index<\/code> is the method.<\/p>\n<div contenteditable=\"false\">\n<hr \/>\n<\/div>\n<h3>Step 3: Update the Controller File Path<\/h3>\n<p class=\"isSelectedEnd\">Locate the following code around line 303:<\/p>\n<pre dir=\"ltr\"><code dir=\"ltr\">if ( ! file_exists(APPPATH.'controllers\/'.$this-&gt;directory.ucfirst($class).'.php'))<\/code><\/pre>\n<p class=\"isSelectedEnd\">Replace it with:<\/p>\n<pre dir=\"ltr\"><code dir=\"ltr\">if ( ! file_exists(APPPATH.'controllers'.DIRECTORY_SEPARATOR.$directory.DIRECTORY_SEPARATOR.ucfirst($class).'.php'))<\/code><\/pre>\n<p class=\"isSelectedEnd\">This change allows CodeIgniter to search for the controller inside the specified subfolder.<\/p>\n<p class=\"isSelectedEnd\">For example, if the controller is located at:<\/p>\n<pre dir=\"ltr\"><code dir=\"ltr\">application\/controllers\/admin\/Welcome.php<\/code><\/pre>\n<p class=\"isSelectedEnd\">CodeIgniter can identify the <code dir=\"ltr\">admin<\/code> subfolder and load the <code dir=\"ltr\">Welcome<\/code> controller.<\/p>\n<div contenteditable=\"false\">\n<hr \/>\n<\/div>\n<h3>Step 4: Set the Controller Directory<\/h3>\n<p class=\"isSelectedEnd\">Add the following line before:<\/p>\n<pre dir=\"ltr\"><code dir=\"ltr\">$this-&gt;set_class($class);<\/code><\/pre>\n<p class=\"isSelectedEnd\">Add:<\/p>\n<pre dir=\"ltr\"><code dir=\"ltr\">$this-&gt;set_directory($directory);<\/code><\/pre>\n<p class=\"isSelectedEnd\">The relevant code should be:<\/p>\n<pre dir=\"ltr\"><code dir=\"ltr\">$this-&gt;set_directory($directory);\n$this-&gt;set_class($class);<\/code><\/pre>\n<p class=\"isSelectedEnd\">This sets the controller directory before CodeIgniter loads the controller class.<\/p>\n<div contenteditable=\"false\">\n<hr \/>\n<\/div>\n<h2>Conclusion<\/h2>\n<p class=\"isSelectedEnd\">Using a subfolder for the default controller can help organize CodeIgniter 3 applications with multiple controllers and modules. By updating the default controller parsing, controller file path, and controller directory settings in <code dir=\"ltr\">Router.php<\/code>, CodeIgniter can load a default controller from a subfolder.<\/p>\n<p class=\"isSelectedEnd\">These changes provide a simple way to support a structured controller directory while continuing to use the CodeIgniter 3 routing mechanism.<\/p>\n<div contenteditable=\"false\">\n<hr \/>\n<\/div>\n<h2>FAQs<\/h2>\n<h3>1. Why do we need to modify Router.php?<\/h3>\n<p class=\"isSelectedEnd\">The default CodeIgniter 3 router expects the controller to be located directly inside the <code dir=\"ltr\">controllers<\/code> directory. These changes allow the router to recognize a controller located inside a subfolder.<\/p>\n<h3>2. What does <code dir=\"ltr\">$directory<\/code> represent?<\/h3>\n<p class=\"isSelectedEnd\"><code dir=\"ltr\">$directory<\/code> represents the subfolder inside the CodeIgniter <code dir=\"ltr\">controllers<\/code> directory.<\/p>\n<p class=\"isSelectedEnd\">For example:<\/p>\n<pre dir=\"ltr\"><code dir=\"ltr\">application\/controllers\/admin\/Welcome.php<\/code><\/pre>\n<p class=\"isSelectedEnd\">Here, <code dir=\"ltr\">admin<\/code> is the <code dir=\"ltr\">$directory<\/code>.<\/p>\n<h3>3. What is the purpose of <code dir=\"ltr\">set_directory()<\/code>?<\/h3>\n<p class=\"isSelectedEnd\">The <code dir=\"ltr\">set_directory()<\/code> method tells CodeIgniter which controller subfolder should be used when loading the default controller.<\/p>\n<div contenteditable=\"false\">\n<hr \/>\n<\/div>\n<h2>Related Articles<\/h2>\n<ol start=\"1\" data-spread=\"true\">\n<li><strong>How to Use a Sub Folder in Default Controller Route in CodeIgniter 3<\/strong><br \/>\n<a href=\"https:\/\/pheonixsolutions.com\/blog\/use-sub-folder-default-controller-route-codeigniter-3\/?utm_source=chatgpt.com\">How to Use a Sub Folder in Default Controller Route in CodeIgniter 3<\/a><\/li>\n<li><strong>Send Email Using HTML Templates in CodeIgniter<\/strong><br \/>\n<a href=\"https:\/\/pheonixsolutions.com\/blog\/send-email-using-html-templates-codeigniter\/?utm_source=chatgpt.com\">Send Email Using HTML Templates in CodeIgniter<\/a><\/li>\n<li><strong>Currency Conversion and Symbol Library in CodeIgniter<\/strong><br \/>\n<a href=\"https:\/\/pheonixsolutions.com\/blog\/currency-conversion-and-symbol-library-in-codeigniter\/?utm_source=chatgpt.com\">Currency Conversion and Symbol Library in CodeIgniter<\/a><\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>Introduction CodeIgniter 3 provides a simple routing mechanism for defining the default controller of an application. By default, the controller is generally placed directly inside the controllers directory. In some applications, controllers are organized into subfolders to maintain a better project structure. In this guide, we will explain how to&hellip; <a href=\"https:\/\/pheonixsolutions.com\/blog\/use-sub-folder-default-controller-route-codeigniter-3\/\" class=\"more-link read-more\" rel=\"bookmark\">Continue Reading <span class=\"screen-reader-text\">How To Use a Subfolder in Default Controller Route In Codeigniter 3<\/span><i class=\"fa fa-arrow-right\"><\/i><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_post_was_ever_published":false},"categories":[221],"tags":[],"class_list":{"0":"post-1517","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"hentry","6":"category-php","7":"h-entry","9":"h-as-article"},"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Use a Subfolder in the default controller route in CodeIgniter 3<\/title>\n<meta name=\"description\" content=\"Learn how to configure CodeIgniter 3 to use a controller inside a subfolder as the default controller by modifying the Router.php file.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/pheonixsolutions.com\/blog\/use-sub-folder-default-controller-route-codeigniter-3\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Use a Subfolder in the default controller route in CodeIgniter 3\" \/>\n<meta property=\"og:description\" content=\"Learn how to configure CodeIgniter 3 to use a controller inside a subfolder as the default controller by modifying the Router.php file.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/pheonixsolutions.com\/blog\/use-sub-folder-default-controller-route-codeigniter-3\/\" \/>\n<meta property=\"og:site_name\" content=\"PHEONIXSOLUTIONS\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/PheonixSolutions-209942982759387\/\" \/>\n<meta property=\"article:published_time\" content=\"2017-05-24T11:01:01+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-08-21T10:30:04+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2017\/05\/Capture.png\" \/>\n\t<meta property=\"og:image:width\" content=\"821\" \/>\n\t<meta property=\"og:image:height\" content=\"381\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@pheonixsolution\" \/>\n<meta name=\"twitter:site\" content=\"@pheonixsolution\" \/>\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=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/use-sub-folder-default-controller-route-codeigniter-3\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/use-sub-folder-default-controller-route-codeigniter-3\\\/\"},\"author\":{\"name\":\"admin\",\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/0ffa33d73c869faec2d50e79c24e3503\"},\"headline\":\"How To Use a Subfolder in Default Controller Route In Codeigniter 3\",\"datePublished\":\"2017-05-24T11:01:01+00:00\",\"dateModified\":\"2026-08-21T10:30:04+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/use-sub-folder-default-controller-route-codeigniter-3\\\/\"},\"wordCount\":454,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/use-sub-folder-default-controller-route-codeigniter-3\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2017\\\/05\\\/Capture-300x139.png\",\"articleSection\":[\"PHP\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/use-sub-folder-default-controller-route-codeigniter-3\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/use-sub-folder-default-controller-route-codeigniter-3\\\/\",\"url\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/use-sub-folder-default-controller-route-codeigniter-3\\\/\",\"name\":\"Use a Subfolder in the default controller route in CodeIgniter 3\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/use-sub-folder-default-controller-route-codeigniter-3\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/use-sub-folder-default-controller-route-codeigniter-3\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2017\\\/05\\\/Capture-300x139.png\",\"datePublished\":\"2017-05-24T11:01:01+00:00\",\"dateModified\":\"2026-08-21T10:30:04+00:00\",\"description\":\"Learn how to configure CodeIgniter 3 to use a controller inside a subfolder as the default controller by modifying the Router.php file.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/use-sub-folder-default-controller-route-codeigniter-3\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/use-sub-folder-default-controller-route-codeigniter-3\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/use-sub-folder-default-controller-route-codeigniter-3\\\/#primaryimage\",\"url\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2017\\\/05\\\/Capture.png\",\"contentUrl\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2017\\\/05\\\/Capture.png\",\"width\":821,\"height\":381},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/use-sub-folder-default-controller-route-codeigniter-3\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How To Use a Subfolder in Default Controller Route In Codeigniter 3\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/\",\"name\":\"Pheonix Solutions\",\"description\":\"We Empower Your Business Growth\",\"publisher\":{\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/#organization\",\"name\":\"PheonixSolutions\",\"url\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2016\\\/12\\\/logo.png\",\"contentUrl\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2016\\\/12\\\/logo.png\",\"width\":454,\"height\":300,\"caption\":\"PheonixSolutions\"},\"image\":{\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/PheonixSolutions-209942982759387\\\/\",\"https:\\\/\\\/x.com\\\/pheonixsolution\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/0ffa33d73c869faec2d50e79c24e3503\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/09bacc0294abee1322a23ab4bc6a0330dd4cb4df707dc9d0b0efeba6c109608b?s=96&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/09bacc0294abee1322a23ab4bc6a0330dd4cb4df707dc9d0b0efeba6c109608b?s=96&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/09bacc0294abee1322a23ab4bc6a0330dd4cb4df707dc9d0b0efeba6c109608b?s=96&r=g\",\"caption\":\"admin\"},\"sameAs\":[\"http:\\\/\\\/pheonixsolutions.com\\\/blog\"],\"url\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/author\\\/admin\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Use a Subfolder in the default controller route in CodeIgniter 3","description":"Learn how to configure CodeIgniter 3 to use a controller inside a subfolder as the default controller by modifying the Router.php file.","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:\/\/pheonixsolutions.com\/blog\/use-sub-folder-default-controller-route-codeigniter-3\/","og_locale":"en_US","og_type":"article","og_title":"Use a Subfolder in the default controller route in CodeIgniter 3","og_description":"Learn how to configure CodeIgniter 3 to use a controller inside a subfolder as the default controller by modifying the Router.php file.","og_url":"https:\/\/pheonixsolutions.com\/blog\/use-sub-folder-default-controller-route-codeigniter-3\/","og_site_name":"PHEONIXSOLUTIONS","article_publisher":"https:\/\/www.facebook.com\/PheonixSolutions-209942982759387\/","article_published_time":"2017-05-24T11:01:01+00:00","article_modified_time":"2026-08-21T10:30:04+00:00","og_image":[{"width":821,"height":381,"url":"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2017\/05\/Capture.png","type":"image\/png"}],"author":"admin","twitter_card":"summary_large_image","twitter_creator":"@pheonixsolution","twitter_site":"@pheonixsolution","twitter_misc":{"Written by":"admin","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/pheonixsolutions.com\/blog\/use-sub-folder-default-controller-route-codeigniter-3\/#article","isPartOf":{"@id":"https:\/\/pheonixsolutions.com\/blog\/use-sub-folder-default-controller-route-codeigniter-3\/"},"author":{"name":"admin","@id":"https:\/\/pheonixsolutions.com\/blog\/#\/schema\/person\/0ffa33d73c869faec2d50e79c24e3503"},"headline":"How To Use a Subfolder in Default Controller Route In Codeigniter 3","datePublished":"2017-05-24T11:01:01+00:00","dateModified":"2026-08-21T10:30:04+00:00","mainEntityOfPage":{"@id":"https:\/\/pheonixsolutions.com\/blog\/use-sub-folder-default-controller-route-codeigniter-3\/"},"wordCount":454,"commentCount":0,"publisher":{"@id":"https:\/\/pheonixsolutions.com\/blog\/#organization"},"image":{"@id":"https:\/\/pheonixsolutions.com\/blog\/use-sub-folder-default-controller-route-codeigniter-3\/#primaryimage"},"thumbnailUrl":"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2017\/05\/Capture-300x139.png","articleSection":["PHP"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/pheonixsolutions.com\/blog\/use-sub-folder-default-controller-route-codeigniter-3\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/pheonixsolutions.com\/blog\/use-sub-folder-default-controller-route-codeigniter-3\/","url":"https:\/\/pheonixsolutions.com\/blog\/use-sub-folder-default-controller-route-codeigniter-3\/","name":"Use a Subfolder in the default controller route in CodeIgniter 3","isPartOf":{"@id":"https:\/\/pheonixsolutions.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/pheonixsolutions.com\/blog\/use-sub-folder-default-controller-route-codeigniter-3\/#primaryimage"},"image":{"@id":"https:\/\/pheonixsolutions.com\/blog\/use-sub-folder-default-controller-route-codeigniter-3\/#primaryimage"},"thumbnailUrl":"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2017\/05\/Capture-300x139.png","datePublished":"2017-05-24T11:01:01+00:00","dateModified":"2026-08-21T10:30:04+00:00","description":"Learn how to configure CodeIgniter 3 to use a controller inside a subfolder as the default controller by modifying the Router.php file.","breadcrumb":{"@id":"https:\/\/pheonixsolutions.com\/blog\/use-sub-folder-default-controller-route-codeigniter-3\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/pheonixsolutions.com\/blog\/use-sub-folder-default-controller-route-codeigniter-3\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/pheonixsolutions.com\/blog\/use-sub-folder-default-controller-route-codeigniter-3\/#primaryimage","url":"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2017\/05\/Capture.png","contentUrl":"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2017\/05\/Capture.png","width":821,"height":381},{"@type":"BreadcrumbList","@id":"https:\/\/pheonixsolutions.com\/blog\/use-sub-folder-default-controller-route-codeigniter-3\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/pheonixsolutions.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How To Use a Subfolder in Default Controller Route In Codeigniter 3"}]},{"@type":"WebSite","@id":"https:\/\/pheonixsolutions.com\/blog\/#website","url":"https:\/\/pheonixsolutions.com\/blog\/","name":"Pheonix Solutions","description":"We Empower Your Business Growth","publisher":{"@id":"https:\/\/pheonixsolutions.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/pheonixsolutions.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/pheonixsolutions.com\/blog\/#organization","name":"PheonixSolutions","url":"https:\/\/pheonixsolutions.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/pheonixsolutions.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2016\/12\/logo.png","contentUrl":"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2016\/12\/logo.png","width":454,"height":300,"caption":"PheonixSolutions"},"image":{"@id":"https:\/\/pheonixsolutions.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/PheonixSolutions-209942982759387\/","https:\/\/x.com\/pheonixsolution"]},{"@type":"Person","@id":"https:\/\/pheonixsolutions.com\/blog\/#\/schema\/person\/0ffa33d73c869faec2d50e79c24e3503","name":"admin","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/09bacc0294abee1322a23ab4bc6a0330dd4cb4df707dc9d0b0efeba6c109608b?s=96&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/09bacc0294abee1322a23ab4bc6a0330dd4cb4df707dc9d0b0efeba6c109608b?s=96&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/09bacc0294abee1322a23ab4bc6a0330dd4cb4df707dc9d0b0efeba6c109608b?s=96&r=g","caption":"admin"},"sameAs":["http:\/\/pheonixsolutions.com\/blog"],"url":"https:\/\/pheonixsolutions.com\/blog\/author\/admin\/"}]}},"jetpack_shortlink":"https:\/\/wp.me\/p7F4uM-ot","jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/1517","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/comments?post=1517"}],"version-history":[{"count":2,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/1517\/revisions"}],"predecessor-version":[{"id":10969,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/1517\/revisions\/10969"}],"wp:attachment":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=1517"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=1517"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=1517"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}