Help with routes - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: Help with routes (/showthread.php?tid=7800) Pages:
1
2
|
Help with routes - El Forum - 04-23-2008 [eluser]louis w[/eluser] This is what I have in my routes files: Code: $route['admin/(.*)'] = "admin/$1"; I want my site to forward any requests besides ones to /admin/ANYTHING to the page controller. /admin/ would go to /admin/ /about/ would go to /page/about/ etc. The second part works, but if i go to /admin/ it does not forward to the admin controller. If i take off the two routes /admin does work. Help with routes - El Forum - 04-23-2008 [eluser]mironcho[/eluser] Hi Louis. This rule: Code: $route['admin/(.*)'] = "admin/$1"; Code: $route['admin'] = "admin"; Code: $route['([^(admin)]*)'] = "page/$1" Help with routes - El Forum - 04-23-2008 [eluser]louis w[/eluser] Thanks for the help. I can not get either to work. I tried Code: // Doesn't work and Code: // Doesn't work Both sit there processing (i think it may be getting stuck in a redirect loop). It's not my site because the below works for non admin pages. Code: // Works for non admin pages Help with routes - El Forum - 04-23-2008 [eluser]mironcho[/eluser] Any errors in apache/codeigniter log files (while processing)? These rules work on my local test server (LAMP) with simple page and admin controllers. Help with routes - El Forum - 04-23-2008 [eluser]louis w[/eluser] What url's are you testing? Do you have a Page and Admin controller? [Tue Apr 22 16:41:58 2008] [error] [client 127.0.0.1] mod_rewrite: maximum number of internal redirects reached. Assuming configuration error. Use 'RewriteOptions MaxRedirects' to increase the limit if neccessary. Help with routes - El Forum - 04-23-2008 [eluser]mironcho[/eluser] Here they are. page.php: Code: <?php Code: <?php Help with routes - El Forum - 04-23-2008 [eluser]louis w[/eluser] Ok, progress. I made a whole new site to make sure there was nothing else conflicting. During this process I noticed that your original route was missing an ending ; I think this caused the loop problem. I have it working with just your two bare bones except in one instance. If you type in /foo/bar it does not rewrite to page (/admin/bar does work). Also, swap out both of your index methods for the below _remap one. I am using it to distribute the request. Code: function _remap() { Help with routes - El Forum - 04-23-2008 [eluser]wiredesignz[/eluser] Code: $route['admin/(.*)'] = "admin/index/$1"; Help with routes - El Forum - 04-23-2008 [eluser]louis w[/eluser] I am using a _remap, don't need index to be called. [quote author="wiredesignz" date="1209004825"] Code: $route['admin/(.*)'] = "admin/index/$1"; Help with routes - El Forum - 04-23-2008 [eluser]mironcho[/eluser] Sorry about missing semicolon (it's late night/early morning here). |