3

I'm setting up a route in control panel. I'd like to use a token that is similar to asterisk but involves forward slashes. Here's an example:

I want to route everything from site.com/blog/* to a single template. If I route site.com/blog/some-uri-identifier , it works fine and I'm able to get "some-uri-identifier" in my template (using slug option). I need to route site.com/blog/some/uri/identifier-long-name and still go to the same template + get "/some/uri/identifier-long-name" in it.

Thanks!

4

The CP route settings don’t have a token for matching multiple URI segments. However you can pull it off from craft/config/routes.php instead:

return array(
    'blog/(.+)' => 'path/to/template',
);

You’ll be able to access whatever was captured by (.*) from your templates via matches[1].

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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