• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Routing question

#1
[eluser]pepijn744[/eluser]
Hi,

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.

#2
[eluser]richthegeek[/eluser]
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:
Code:
$routes['register'] = '/users/register';
$routes['contact'] = '/controller/contact';
$routes['profile'] = '/users/profile';
$routes['(:any)'] = '/show/$1';

Should sort you out.

#3
[eluser]pepijn744[/eluser]
Thanks! It works now. I have to correct you on the variable name, it is $route instead of $routes.

#4
[eluser]richthegeek[/eluser]
Sorry,haven't used routes in a while so was writing from memory

#5
[eluser]pepijn744[/eluser]
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.

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

#7
[eluser]pepijn744[/eluser]
Oops I see! Thank you, I will not bother you anymore.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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