How to override canonicalUrl best?


#1

Enonic version: 7.2.1
OS: Red Hat Linux

We would like to be able to override canonicalUrl on spesific pages.
That is we want to tell Google “Hey, this content is now over there!” Could be outside XP.
The easiest way is to put a mixin for this url in relevant content types and check for values in the page controller.
BUT: This means that editors can change this, “by accident”.

Any suggestions on how to do this safely? That is only admin/developer can controll this.


#2

There are many ways of doing this if you want to prevent editors from controlling it.

  1. Using redirect functionality in your web servers (i.e. apache, nginx)
  2. Adding functionality into your application (reading from config file or site config)
  3. Waitning a month or two to get the new rewrite app we are building