URLs... remove subfolder

EDIT: issue now is getting routes to work with brackets in URL. see last post.

I have the following pages/addresses on my site..


Currently going to example.com shows example.com/main. This is great.

What I would really like to do is to show example.com/main/first by going to example.com/first, etc, whilst not breaking example.com/another etc.

How can i do this, please?

[edit:]FWIW if i am going to need to involve an array to include/exclude then it would be much easier to make an array of (another, yet_another, even_more, etc) than (first, second, etc.)

Use routes to route the URI example.com/first to main/first. See the User Guide.

$mains =array('first', 'second', 'third',... 'fifteenth');

foreach($mains as $main){
    $sub = url_encode($main);
    $route[$sub.'/:any'] = "main/main/$sub/$1";
This does not work, is the only option to write out a rule for each of them??

** actually seems like it needs two rules for each...

$route['first/:any'] = "main/main/first/$1";
and $route['first'] = "main/main/first";

and they are case sensitive

let me know if there is a better way.

EDIT: also having problems where brackets are involved.. this gives a 404.

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.