0

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.

Community
  • 1
  • 1

1 Answers1

0

Comment this line in your routes.php:

$route['new_account/(:any)'] = "new_account";

Codeigniter default routes should work for http://YOUR_SITE/new_account/step1 cause you have a controller file called step1.php inside the folder new_account. Also check that the name of the class of your controller inside step1.php is Step1

m4t1t0
  • 5,669
  • 3
  • 22
  • 30
  • Thank you. I commented `$route['new_account/(:any)'] = "new_account";` and when I went to `site_name/new_account/step1`, it redirected to a 404 message. I used a link to get to `step1`. I also have controllers like `personal_info.php` with a class name of `Personal_info`. What do you think? –  Jan 28 '13 at 08:48
  • 1
    I have revised your routes.php again, comment this line: $route['(:any)'] = 'pages/show_page/$1'; too and try again. – m4t1t0 Jan 28 '13 at 09:41