In the Panel, in a Writer Field, I’ve linked to some other pages on the website. The links work on my local computer, but now I’ve moved the site to the server the links no longer work.
Locally the link links to /about/our-vision page
but on the live site it links to a page called @/page/TUgFQB7JUzEzY4YU and the error page appears.
If I add links in a Writer Field to internal pages, the links do not work. Instead of linking for example to the /about/our-vision page, it links to the permalink @/page/TUgFQB7JUzEzY4YU.
Do I really need to add the permalinksToUrls() code to all my templates and snippets to get links to work?
$page->text()->permalinksToUrls()
(The site is now live and no longer on a subdomain)
permalinksToUrls() is certainly a solution that also avoids internal redirects for those links. This can improve the site performance, user experience and SEO performance.
However, the permalinks should work directly as well. You write that the links “don’t work”. Do you have more details on what doesn’t work? Do you get an error message, if so, which one?
I’m using the Writer Field and creating links to internal pages. In the website when I click the link I just get the 404 error page. This is because it is trying to link a page called
Thanks for the additional details. The Force HTTPS option shouldn’t be related.
Since you wrote the content on your local machine, it could be that the UUID cache on the server is not yet complete. Kirby automatically updates it whenever a page is referenced, but it may not have made it to your production deployment.
You can regenerate the cache by calling Kirby\Uuid\Uuids::populate(); once. You can e.g. place this in a template temporarily, open the page and then remove the line again.
The permalinks (URLs that begin with /@/) require the UUID cache. This allows Kirby to quickly look up the actual page URL for each UUID. Without the cache, Kirby would have to search the whole page tree, which can cause a significant performance impact or even be used by attackers to make your site unavailable for a bit. That’s why the permalinks only work with the cache in place.
If you continue editing your site on the server via the Panel, Kirby will manage the UUID cache automatically.
Links from and to pages without “www” work.
Links from and to page with “www” do not work.
https://example.com/about to https://example.com/about/our-story – work https://www.example.com/about to https://www.example.com/about/our-story– do not work
I’ve added <?php Kirby\Uuid\Uuids::populate(); ?> to my homepage template and visited not only https://example.com but also https://www.example.com.
The links now work regardless of www or no www.
Next questions are:
Why is the cache going wrong?
How can I avoid problems with the cache in the future?
Can I leave <?php Kirby\Uuid\Uuids::populate(); ?> on my homepage template?