-
Notifications
You must be signed in to change notification settings - Fork 641
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Root relative site URLs no longer work #3221
Comments
I don’t think it was that commit, and don’t remember the exact issue off the top of my head, but the change was intentional. |
Looking at the changelog, I'm guessing it was this:
So root/protocol relative values are ok in the My use-case for wanting a root-relative siteUrl is using Craft as a detached API, where having full URLs sometimes doesn't make sense. Obviously there are times where you do need a full URL though (URLs in email). It almost seems like maybe there could be a third template rendering mode (CP, site, email/external) to manage things like this. |
Right, that's the one. Committed in 4848022, which fixed #2919. It’s pretty easy to turn an absolute URL into a root-relative URL using parse_url(), so maybe you could just use that when you need it? $url = parse_url($url, PHP_URL_PATH); |
In my case that's not really a possibility (I don't think), as this is an API (CraftQL), not Twig – so I'd have to know any field/fieldtype that might use If At this point, I'm all set: I'm just making the dev consuming my API parse the URI out. :) |
I think this was introduced here: c17487b#diff-8761a7cd35e729b6fadc9ebfa1200391
craft\helpers\UrlHelper::url
will now always return a full url, even if yoursiteUrl
is explicitly root relative (e.g./
)The text was updated successfully, but these errors were encountered: