This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.
Hello, I would like a specific page on my site to have the dynamic url from the base of the url, for example: site.com/:service_name
according to the code implement this page as follows.
title = "servicos" url = "/:service_name" ...
<?php use Cts\Site\Models\Service;
function onStart() { $service = Service::where('name',$this->param('service_name'))->first(); if(!$service){ return $this->run('404'); } $this['service'] = $service; } ?>
the problem is that when i implement this type of url on my system the 404 error pages stop working when I type a nonexistent url and the error http 500 occurs.
would anyone know how to solve this?
I tested this and it's working fine. Did you setup a page with url="/404" ? Otherwise $this->run('404') in onStart() will fail and the markup for your servicos page will be rendered (potentially with errors)
Last updated
Perfect! it was actually loading the 404.htm file.
I want to take the opportunity to congratulate the whole community for the project. I worked with Wordpress for years and a short time ago I got to know OctoberCMS. It is incredible, very simple and versatile. I'm super excited to migrate my projects to October.
1-3 of 3