![]() |
HTACCESS questions - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22) +--- Thread: HTACCESS questions (/showthread.php?tid=54284) |
HTACCESS questions - El Forum - 09-01-2012 [eluser]Jason van der Zeeuw[/eluser] Hi everyone, I have some questions about htaccess in codeigniter. I want to be able to do the following things: /category /category/subcategory /category/subcategory/subsubcategory (these categories are stored in my database) /infopage (a page which doesn't need functions, just text) /controller/function/id (the standard one) so if someone goes to mysite.com/hello I want to check if it is a category, if it's not a category I want to check if it is an info page, else it must be a controller, or the 404 page will show up. But i don't know how the info pages work, do i have to make a new controller for each page? i.e. I want mysite.com/aboutus do i need to make a controller "aboutus.php" with an index function, or are there better ways to accomplish this? I hope that you guys can help me out with this one, because I have no idea where to start. Thanks! HTACCESS questions - El Forum - 09-01-2012 [eluser]CroNiX[/eluser] Look into routes and _remap(). HTACCESS questions - El Forum - 09-02-2012 [eluser]Jason van der Zeeuw[/eluser] Can you help me out with the following: example.com/gifts/awesome first: check if "gifts" exists in de database, else check if it is an info page else load the controller, or show 404 and then a little question which I asked before, "I don’t know how the info pages work, do i have to make a new controller for each page? i.e. I want mysite.com/aboutus do I need to make a controller “aboutus.php” with an index function, or are there better ways to accomplish this?" I can offer money to help me if you can help me all the way out with this! HTACCESS questions - El Forum - 09-04-2012 [eluser]XMadMax[/eluser] The routes conf must to be declared in order of: First, knowed paths (as you say, infopage) Last, unknown paths (for categories, etc...) in inverse length order: For 3 levels: ([a-z0-9_-]+)/([a-z0-9_-]+)/([a-z0-9_-]+) For 2 levels: ([a-z0-9_-]+)/([a-z0-9_-]+) For 1 level: ([a-z0-9_-]+) Anyway, if your unknown path is a controller/function, codeigniter can find it (if exists). Any other paths will go to the controller you define in your routes conf. |