I'm using the following (https://github.com/rsanchez/resource_router):

$config['resource_router'] = [
    'news-and-resources' => 'www/news-and-resources',
    'usa/news-and-resources' => 'www/news-and-resources',
    'cn/news-and-resources' => 'www/news-and-resources',
    'zh/news-and-resources' => 'www/news-and-resources',
    'usa/news-and-resources/:pagination' => 'www/news-and-resources',

The last array item should match a url of -


But it just throws a 404 error, even though I know it should load more entries.

What's causing this problem? I'm using Expression Engine 3.4.1


Using the Resource Router plugin (purely because I can’t get this working inside EE’s routing system) I’ve done this:

$config['resource_router'] = array(
    'news-and-resources/:pagination' => 'www/news-and-resources',
    '(usa|cn|zh)/news-and-resources/:pagination' => 'www/news-and-resources',
    'news-and-resources/(news|resource)/:pagination' => 'www/news-and-resources',
    '(usa|cn|zh)/news-and-resources/(news|resource)/:pagination' => 'www/news-and-resources',

So, based on the routes above, the following page requests work and load correct content:



You’ll notice the only difference is that there is no


And that’s because it’s the only one that doesn’t work, despite there being a route defined

'(usa|cn|zh)/news-and-resources/:pagination' => 'www/news-and-resources

  • 1
    EECMS 4? Already? You're fast!
    – Sobral
    Sep 28, 2016 at 18:39
  • Also, your first segment could be (usa|cn|zn).
    – Sobral
    Sep 28, 2016 at 18:40
  • Haha, 3.4.1, my bad ;) Sep 28, 2016 at 18:42

1 Answer 1


Do the other links work as expected (like zh/news-and-resources)? Try this:

$config['resource_router'] = array(
    'news-and-resources' => 'www/news-and-resources',
    'usa/news-and-resources/:pagination' => 'www/news-and-resources',
    'cn/news-and-resources' => 'www/news-and-resources',
    'zh/news-and-resources' => 'www/news-and-resources',

You should only need the usa/news... once, because :pagination is an optional segment: it should match that line with or without pagination.

Update: From Robson's comment, this is also possible:

$config['resource_router'] = array(
    'news-and-resources' => 'www/news-and-resources',
    '(usa|cn|zn)/news-and-resources/:pagination' => 'www/news-and-resources',

To test that resource router is matching the url, you can do something like:

$config['resource_router'] = array(
    'usa/news-and-resources/:pagination' => function($router, $wildcard) {
        return 'This URL matched.';
  • Yeah the other routes work fine, I'll try your idea - 5 mins Sep 28, 2016 at 18:36
  • Nope, still throws a 404, I'm totally stumped Sep 28, 2016 at 18:42
  • You don't have anything set in the regular ee template router that would conflict? Just guessing. Sep 28, 2016 at 18:45
  • Not that I'm aware of, though interestingly if I change 'usa/news-and-resources/:pagination' => 'www/news-and-resources', to 'usa/news-and-resources/:pagination' => 'www/index', it does re-route to the index page. So, seems like there's a bug in my pagination pulling in results rather than routing Sep 28, 2016 at 18:47
  • Okay, so the route matches, but the pagination is broken. I guess it's time for me to speak to Ellis Labs, unless you guys are aware of anything? Sep 29, 2016 at 8:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.