Router problem with Pattern at end of URL

Hi,

Goole is indexing wrong sites on our blog. Maybe still in googles cache? I don’t know, anyway.

I tried to redirect the wrong URL with no success yet.

Here is a wrong Url: https://mydomain.de/schutz-gegen-ransomware-locky-und-co/blog/category:Sicherheit

This part is wrong: /blog/category:Sicherheit and should be removed but the router want work.

Here is my router:

/*-------------------------------------
Setup Kirby Routes
-------------------------------------*/
c::set('routes', array(
  array(
    'pattern' => '(:any)',
    'action'  => function($uid) {
      $page = page($uid);
      if(!$page) $page = page('blog/' . $uid);
      if(!$page) $page = site()->errorPage();
      return site()->visit($page);
    }, 'method' => 'GET|POST'
  ),
  array(
    pattern' => '(:all)/blog/category:(:all)',
   'action'  => function($uid) {
      return site()->visit($uid);
   }
  ), 
  array(
    'pattern' => 'blog/(:any)',
    'action'  => function($uid) {
      go($uid, 301);
    },'method' => 'GET|POST'
  ),
  array(
    'pattern' => '(:any)/feed',
    'action'  => function($uid) {
      go('feed');
    }, 'method' => 'GET|POST'
  ),
  array(
    'pattern' => 'page/(:num)',
    'action'  => function($num) {
      go('page:'.$num);
    }
  )
));

Any idea what’s wrong here?

Svnt

I think, you can’t use parameters in routes.

Sad.
So there is no way to cut away the “/blog/cat…” part?

Maybe you can do it in your .htaccess or server configuration?

You can also get Google to remove the URL from their search engines.

If this are the only two option i’ll try it.

Thank you!

Well, actually, if it is just for simple rewrites like this, where no Kirby code is needed, those two options are preferable to using routes, anyway.