Issue Bug Closed

#97709Cannot generate absolute URL with uriBuilder

Florian Rival 05/30/22, 15:08 updated 05/31/22, 19:33

Description

If you try to generate an absolute URL with uriBuilder, you only have a relative URL.

$uri = $uriBuilder
    ->reset()
    ->setTargetPageType($pageType)
    ->setCreateAbsoluteUri(true)
    ->setTargetPageUid((int)$pageUid);

$absoluteUrl = $uri->build();

$absoluteUrl should have something like this:

https://www.mysite.com/the-page

and it has this instead :

/the-page

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.

History 4

  1. Florian Rival changed category 05/30/22, 15:08

  2. Georg Ringer commented and changed status New Needs Feedback 05/30/22, 17:38

    did you provide a full url in the site configuration as entry point? see description

    > Main URL to call the frontend in default language. Can be https://www.example.com/ or just /, if it is just a / you cannot rely on TYPO3 creating full URLs

  3. Florian Rival commented 05/31/22, 09:12

    You’re right Georg, I didn’t set the full domain name in site configuration, this is the reason why it doesn’t work.
    Thanks for your help, you can close this issue.

  4. Georg Ringer changed status Needs Feedback Closed 05/31/22, 19:33