![]() |
Rewrite help. - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forum-21.html) +--- Thread: Rewrite help. (/thread-21537.html) |
Rewrite help. - El Forum - 08-12-2009 [eluser]adrian.web20[/eluser] I'm really really tired. I've been working all day on this. First of all, the User Guide helped me a lot but until a point. Right now, my head doesn't help me a lot. I seriously need somebody to tell me "Dude, it's wrong because: " Please help me :| I'm kinda desperate. I want to make a job seeker website. I've made a db with some job domains categories. This is the URL for testing purposes: http://blt.ath.cx/ I've hit a big bad wall here. As you can see on the website. The rewrite works perfectly... a bit messed up but that's not a problem, for now. I've manage to go so far but... know I realize I can't do nothing because I don't know how to get the ID from the category, which is very important. Can somebody please, look over my work and give me some suggestions? I can't continue without your help :| Thank you acasa.php Code: <?php oferta.php Code: <?php 2 views acasa_view.php Code: <html> domeniu_view.php Code: <html> .htaccess Code: RewriteEngine On Rewrite help. - El Forum - 08-12-2009 [eluser]kaola[/eluser] RewriteEngine On RewriteBase / RewriteRule ^categorie/(.*)\.html$ /oferta/categorii/$1 [C] RewriteRule ^(.*)$ /index.php/$1 [L] Rewrite help. - El Forum - 08-12-2009 [eluser]Rick Jolly[/eluser] This might work: Code: RewriteEngine On To keep your .htaccess simpler, you might want to use CI routes instead for these routing exceptions: http://ellislab.com/codeigniter/user-guide/general/routing.html Rewrite help. - El Forum - 08-12-2009 [eluser]tomcode[/eluser] Two comments: 1. Maybe You have Your reasons to use two controllers, but for what You are doing You need only one controller : Code: class Acasa extends Controller{ Which changes Your URL's to : Code: anchor('acasa/categorii/xx'); Code: $config['url_suffix'] = ".html"; Code: RewriteEngine On Rewrite help. - El Forum - 08-13-2009 [eluser]adrian.web20[/eluser] But the parameter for the categorii() function is something like this: 1-agricultura-pescuit-si-silvicultura.html How do I use the id (ex: 1) to query the database for detailes ? Thanks a lot! Rewrite help. - El Forum - 08-13-2009 [eluser]tomcode[/eluser] Do You need to pass the whole (1-agricultura-pescuit-si-silvicultura.html), passing only the id (1) does it, too. If yes though, You could do : Code: $cat_parts = explode('-', $categorie); Rewrite help. - El Forum - 08-13-2009 [eluser]adrian.web20[/eluser] Geez :| You are an angel sent from Heaven ![]() Thank you have much. |