diff --git a/lib/Disco.php b/lib/Disco.php
index 458b038899e9fa8bd7f37e5d001e80bfb57b8898..1c4af10517437fda969be9e618d05d6b2748f12f 100644
--- a/lib/Disco.php
+++ b/lib/Disco.php
@@ -366,8 +366,16 @@ class Disco extends PowerIdPDisco
         string $entityID,
         string $return,
         string $returnIDParam,
-        string $idpEntityId
+        string $idpEntityId,
+        bool $relative = false
     ): string {
+        if ($relative) {
+            return '?' .
+                'entityID=' . urlencode($entityID) . '&' .
+                'return=' . urlencode($return) . '&' .
+                'returnIDParam=' . urlencode($returnIDParam) . '&' .
+                'idpentityid=' . urlencode($idpEntityId);
+        }
         return Module::getModuleURL(self::DISCO_IDP_SELECTED_REDIRECT) . '?' .
             'entityID=' . urlencode($entityID) . '&' .
             'return=' . urlencode($return) . '&' .
@@ -385,8 +393,15 @@ class Disco extends PowerIdPDisco
     public static function buildContinueUrlWithoutIdPEntityId(
         string $entityID,
         string $return,
-        string $returnIDParam
+        string $returnIDParam,
+        bool $relative = false
     ): string {
+        if ($relative) {
+            return '?' .
+                'entityID=' . urlencode($entityID) . '&' .
+                'return=' . urlencode($return) . '&' .
+                'returnIDParam=' . urlencode($returnIDParam);
+        }
         return Module::getModuleURL(self::DISCO_IDP_SELECTED_REDIRECT) . '?' .
             'entityID=' . urlencode($entityID) . '&' .
             'return=' . urlencode($return) . '&' .
diff --git a/lib/DiscoTemplate.php b/lib/DiscoTemplate.php
index 842e076885d971db34a83d7fc436c74012cd728b..f54bda4afca9d4fb1b7b6a16ce8d714787790435 100644
--- a/lib/DiscoTemplate.php
+++ b/lib/DiscoTemplate.php
@@ -136,25 +136,27 @@ class DiscoTemplate extends Template
     /**
      * @return string url where user should be redirected when he choose idp
      */
-    public function getContinueUrl(string $idpEntityId): string
+    public function getContinueUrl(string $idpEntityId, bool $relative = false): string
     {
         return Disco::buildContinueUrl(
             $this->data[Disco::ENTITY_ID],
             $this->data[Disco::RETURN],
             $this->data[Disco::RETURN_ID_PARAM],
-            $idpEntityId
+            $idpEntityId,
+            $relative
         );
     }
 
     /**
      * @return string url where user should be redirected when he choose idp
      */
-    public function getContinueUrlWithoutIdPEntityId(): string
+    public function getContinueUrlWithoutIdPEntityId(bool $relative = false): string
     {
         return Disco::buildContinueUrlWithoutIdPEntityId(
             $this->data[Disco::ENTITY_ID],
             $this->data[Disco::RETURN],
-            $this->data[Disco::RETURN_ID_PARAM]
+            $this->data[Disco::RETURN_ID_PARAM],
+            $relative
         );
     }