Skip to content

Use the selected site base URL for the static page preview - #556

Merged
daftspunk merged 1 commit into
rainlab:masterfrom
DonnyOexman:fix/preview-url-edit-site
Nov 14, 2026
Merged

daftspunk merged 1 commit into
rainlab:masterfrom
DonnyOexman:fix/preview-url-edit-site

Conversation

@DonnyOexman

Copy link
Copy Markdown
Contributor

Problem

In the v3 editor, pagePreviewUrl() builds the preview link with Url::to(), which uses the host of the current backend request. With multisite, when the backend runs on one site's domain and another site is selected in the site picker, Preview opens the page on the backend's domain instead of the selected site. In v2, getPreviewPageUrl() used Cms::fullUrl(), which resolves the edit site's base URL.

Fix

Use Cms::fullUrl() again, so the preview uses the base URL of the site selected in the backend. The v2 cms.sitePicker.overridePattern hook is not restored here; happy to add it if wanted.

Test

Added PreviewUrlTest with a second site on its own domain. It fails without the fix (request host) and passes with it; the full suite passes.

@daftspunk
daftspunk merged commit 4a282ae into rainlab:master Nov 14, 2026
@daftspunk

Copy link
Copy Markdown
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants