I am having trouble in routing my files. I need to access the new_account
subfolder and the controllers inside it...
Here is the structure:
controllers
---new_account
---------step1.php
---------step2.php
---accounts.php
---pages.php
This is the content of my .htaccess
file located outside application
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L]
And here is my routes.php
$route['default_controller'] = 'pages/show_page/home';
$route['pages/(:any)'] = 'pages/show_page/$1';
$route['accounts'] = 'accounts';
$route['new_account/(:any)'] = "new_account";
$route['(:any)'] = 'pages/show_page/$1';
$route['404_override'] = '';
I also use $config['uri_protocol'] = 'REQUEST_URI';
My pages
controller is working perfectly, even as direct links e.g. <?php echo base_url(); ?>home
redirects to ../pages/home.php
.
The accounts.php
controller calls new_account/user_home.php
that contains guidelines and a link to the actual form. The link is <?php base_url();>new_account/step1
and it does not work which should have because of $route['new_account/(:any)'] = "new_account";
.
Whenever I click the link to new_account/step1
, I get redirected to the main home page.
I really want to access app_name/new_account/step1
and the others in the directory...Did I miss something in these files or an integral step?
NOTE:
I also tried this subfolder routing extension by inserting MY_Router.php
in the application/libraries
folder but no changes happened. I then moved it into application/core
but all I get is a server error.