Routes modification causes fuel cms backend login page to disappear

edited April 2014 in Modules
Not sure where else I should put there because there's no general category but I seem to be causing an error when I add the following route configurations:

$route['(fuel|fuel:any|faq|faq:any|backstage|backstage:any|auth|auth:any|assets|assets:any)'] = "$1";
$route['(:any)'] ="registry_page";
$route['(:any)/(:any)'] ="registry_page";

Any ideas how I can make it so that when you go to mysite.com/fuel it goes to the fuel cms login page?

Comments

  • edited 5:02PM
    You mean it currently doesn't go to the login page without the routes (that is the URL to access the FUEL CMS admin)?
  • edited 5:02PM
    I modified the routes file and included those additional settings. Yes, it no longer goes to the login page once I put in those additional settings.
  • edited 5:02PM
    For clarification: I have a user registration process whereby if you create a username like johndoe, you will be able to access your profile at mysite.com/johndoe. Modifying the routes file like what I have in my original post should create the re-routing. However, since fuelcms has its routing rules, it seems to mess up when I try to access mysite.com/fuel. If I put in the modified settings in a regular CodeIgniter install, it works. if I do it for a FuelCMS install, it doesn't work--well, it works but I can no longer access mysite.com/fuel (the Fuel CMS login page).
  • edited 5:02PM
    Have you tried changing the MY_fuel.php $config['fuel_path'] value?
  • edited 5:02PM
    I've put this off as the last thing before launching my site--I've tried everything and I can't seem to figure it out.. any other ideas?

    What do you suggest I change the MY_fuel.php $config['fuel_path'] value to? It's currently set to the default 'fuel/' which should be correct.
  • edited 5:02PM
    After looking through my Network activity.. looks like things are getting hung up once Fuel reaches this point:

    http://website.com/fuel/envelope_order_activities/items/?search_term=&limit=50&view_type=list&offset=0&order=asc&col=source_1&fuel_inline=0&csrf_token=4bfd43c345c7e70484c5f1a9a248d9be

    I'm thinking it might be the question mark in the URL that's causing it?
  • edited 5:02PM
    I've upgraded to the latest version of FuelCMS. It no longer causes issues for me on the login page. However, when I try to access a simple module, it will load everything up until it loads the data associated with the module (once it tries to load the items that I described above)
  • edited 5:02PM
    If you look at your browser console, in particular the AJAX request to that URL you posted above, what is the error/content that is being returned from that request?
  • edited 5:02PM
    The response for that is a 404. If I remove the modified routes in my initial post, everything works fine.
  • edited 5:02PM
    If you remove that route, does it work?
  • edited 5:02PM
    Which route are you referring to? I've tried everything--placing the routes in different places, adding :any, etc. Nothing seems to work. I'll keep playing around with it..
  • edited 5:02PM
    Here's a screenshot of what is eventually loaded:
    http://snag.gy/XJSij.jpg

    Here's a screenshot of the network activity within Chrome's browser console:
    http://snag.gy/4mwIp.jpg
  • edited 5:02PM
    admin,

    you can see this problem happening for yourself by creating a simple module and adding routes that allows for dynamic URLs like what's used for Twitter (ie: twitter.com/username).

    Here's an example route file that would cause the issue:

    $route['default_controller'] = 'fuel/page_router';
    $route['404_override'] = 'fuel/page_router';

    $route['(google_analytics|google_analytics:any|assets|assets:any|about|help|help:any|faq|faq:any|questions|questions:any|ajax|ajax:any|auth|auth:any|checkout|checkout:any)'] = "$1";
    $route['fuel/(:any)'] = 'fuel';
    $route['tracking/(:any)'] = 'tracking';
    $route['login/(:any)'] = 'user_login';
    $route['(:any)'] = 'profile';
    $route['(:any)/(:any)'] = 'profile';
  • edited 5:02PM
    I'm wondering if this is a Fuel CMS bug or bad configuration on my end?
  • edited 5:02PM
    Have you tried moving your routes to after the included fuel routes? Or have you tried the process of elimination to figure out which route is causing the problem?
  • edited 5:02PM
    Yep. I've tried everything... I will try moving it around again tonight (above, before, removing routes, etc) and let you know my results.
  • edited 5:02PM
    Tried everything again just now... moved everything around in different places. Not sure where to go from here... The only solution now is to not allow for dynamic urls via the following route......

    $route['(:any)'] = 'profile';
    $route['(:any)/(:any)'] = 'profile';

    Has anyone ever faced this issue??? Surely I can't be the only one who has needed dynamic something like this.
  • edited 5:02PM
    If it helps, I know what's causing the problem. Adding a route for fuel will cause the issue. So, any of the following will cause problems:

    $route['fuel'] = 'fuel';
    $route['fuel|fuel:any'] = '$1';
    $route['fuel|fuel/(:any)'] = '$1';

    anyway.. i've tried all variations and nothing seems to work. The issue also shows up even without the following:

    $route['(:any)'] = 'profile';
    $route['(:any)/(:any)'] = 'profile';
  • edited 5:02PM
    Eureka! Figured it out...

    Instead of this:

    $route['fuel'] = 'fuel';
    $route['(:any)'] = 'profile';
    $route['(:any)/(:any)'] = 'profile';

    Use this:
    $route['^(?!fuel)\S*'] = 'profile';

    I hope this helps someone out in the future. Thanks for assisting, admin!

    Side question:
    1. How do I properly display code on the forum?
    2. When I load website.com/fuel, it redirects to website.com/fuel/index and can't find the page... anyway to fix this?
  • edited 5:02PM
    1. Use the "code" html tags
    2. Are you on an older version of FUEL? The reason I ask is because it should be redirecting to start instead of index to prevent some issues we found on certain environment setups.
  • edited 5:02PM
    2. I was on 1.0 then I upgraded to the most recent version. That might be causing it... it's not a big deal. I'll do a fresh install for my next release and I'm sure it will fix it.
Sign In or Register to comment.