Help creating a redirect URL

Hi all,

Am extremely new to Kirby (like, ten minutes!) and have an urgent change I’ve been asked to make on behalf of a client. We have a page set up at projecttitle.film/watch-the-film and I need to create a redirect URL, or make a page available at two URLs so I can also send people to projecttitle.film/watch.

Sorry - designer here, not a website creator, and just trying to figure things out to make a publishing deadline!

I’d say the easiest way would be to go to your config.php file and add a route:

<?php
return [
'debug' => false, // or any other config you already have
'routes' => [
  [
    'pattern' => 'watch',
    'action' => function () {
      return go('watch-the-film', 301);
    }
  ],
]
];

This will route people going to /watch to /watch-the-film with a 301 redirect.

Edit: …and welcome as a new Kirby user! :slight_smile:

How do I get to that file? (And thank you for helping!)

If you don’t have it already, you can create it at /site/config/config.php.
Basically the whole code block from above could just be the content of the file. (I just edited in starting php-tag too)

Relevant further docs on the config-file is available here also: