Welcome Guest, Not a member yet? Register   Sign In
Routing question


I'm entering the final stage of the project I'm working on right now and I want to add a routing feature.

Say, my site is www.site.com. I want to redirect all of the first URI segment, except for /register, /contact, /aboutus, to /profile/show/$1. Is something like that possible? I'm already using the mod_rewrite, so no www.site.com/index.php/(.*) anymore.

Thanks in advance.

routes are executed in the order that they are listed, and matching one stops the execution of the rest.

As such, having your routes looking something like this:
$routes['register'] = '/users/register';
$routes['contact'] = '/controller/contact';
$routes['profile'] = '/users/profile';
$routes['(:any)'] = '/show/$1';

Should sort you out.

Thanks! It works now. I have to correct you on the variable name, it is $route instead of $routes.

Sorry,haven't used routes in a while so was writing from memory

You helped me out so no problem Smile

I have another question... I'm adding an extern forum in /forum/, can i make an exception for this folder so it doesn't go to CodeIgniter? I think I'll have to change .htaccess for this. Can anybody help me out? I'm not so good at this area.

the htaccess only redirects if there is no physical location at that adress... Which is why your /CSS and/or /assets folder work

Oops I see! Thank you, I will not bother you anymore.

Theme © iAndrew 2016 - Forum software by © MyBB