Force string URL to be stored in SilverStripe Admin

For SEO purposes, I need to make sure that all URLs are saved as lowercase.

How do I get the SilverStripe administrator to keep the URL lowercase, even if the user enters a permalink in upper case?

+4
source share
1 answer

You can do this in your method Page onBeforeWrite:

protected function onBeforeWrite() {
    parent::onBeforeWrite(); //this is important!
    $this->URLSegment = strtolower($this->URLSegment);
}

See API Docs

+6
source

Source: https://habr.com/ru/post/1612942/


All Articles