0

Help me find a solution for subsections.

Category: /blog/cat1/ /blog/cat/cat2/cat3/

Detail: /blog/cat/cat2/cat3/element_code

Subsection for tags in section 'blog': /blog/tag/ /blog/tag/some-tag/

I have this rules:

[
                'pattern' => '/blog/tags/<title>',
                'route' => 'blog/tag',
                'encodeParams' => false
            ],
            [
                'pattern' => 'blog/tags/',
                'route' => 'blog/tags/',
                'encodeParams' => false
            ],

            [
                'pattern' => 'blog/<category:[\w_\/-]+>/<slug>',
                'route' => 'blog/post',
                'encodeParams' => false
            ],
            [
                'pattern' => 'blog/<category:[\w_\/-]+>',
                'route' => 'blog/category',
                'encodeParams' => false
            ],

But in tag section (/blog/tag/) Category controller starts, no Tag controller. What to do in this case?

Mary
  • 37
  • 9
  • Are you sure it's `'route' => 'blog/tag',` not `'route' => 'blog/tags',`, as pattern has `/tags` not `/tag` value. – Vidhyut Pandya Mar 01 '19 at 12:53
  • Hello! yes, in route 'blog/tag' i have controller Tag for view all posts by some tag (like TagPosts). But, if i delete this section for detail by tag, I still have a mistake with the section /blog/tags/ – Mary Mar 01 '19 at 13:01
  • What is the value of `enableStrictParsing` in your config? Is it true/false? – Vidhyut Pandya Mar 01 '19 at 13:09
  • Turn it on and off - nothing changes... – Mary Mar 01 '19 at 13:14
  • You have `tags` in your pattern, while you're accessing `blog/tags` URL. – rob006 Mar 01 '19 at 14:17
  • 1
    Sorry, the problem was different. The rules are all correct. Thank you for wanting to help! – Mary Mar 01 '19 at 14:39
  • Unfortunately, the problem remained. @rob006 What did you mean in your last message? – Mary Mar 04 '19 at 10:32
  • You're requesting `/blog/tag/some-tag/` while your rule expects `/blog/tags/some-tag/`. `tag` vs `tags`. – rob006 Mar 04 '19 at 10:59
  • even if I leave [ 'pattern' => 'blog/tags/', 'route' => 'blog/tags/', 'encodeParams' => false, ], the category controller will override – Mary Mar 04 '19 at 11:29

0 Answers0