diff --git a/docs/simplesamlphp-sp-api.md b/docs/simplesamlphp-sp-api.md
index e5b722b05655863e660e8a5695e2072e97789ff7..91391200ab7f0c8cd6717b99a8ca4f97ce22ec4c 100644
--- a/docs/simplesamlphp-sp-api.md
+++ b/docs/simplesamlphp-sp-api.md
@@ -256,7 +256,7 @@ The URL returned by this function is static, and will not change.
 You can easily create your own links without using this function.
 The URL should be:
 
-     .../simplesaml/module.php/core/as_login.php?AuthId=<authentication source>&ReturnTo=<return URL>
+     .../simplesaml/module.php/core/login/<authentication source>/?AuthId=<authentication source>&ReturnTo=<return URL>
 
 
 `getLogoutURL`
diff --git a/lib/SimpleSAML/Auth/Simple.php b/lib/SimpleSAML/Auth/Simple.php
index 419a2ca8987bde00d66ad34122295ce27751f47a..b99e2528785e09e012d34441593e5215f36bd8c5 100644
--- a/lib/SimpleSAML/Auth/Simple.php
+++ b/lib/SimpleSAML/Auth/Simple.php
@@ -321,7 +321,7 @@ class Simple
             $returnTo = $httpUtils->getSelfURL();
         }
 
-        $login = Module::getModuleURL('core/as_login.php', [
+        $login = Module::getModuleURL('core/login/' . urlencode($this->authSource, [
             'AuthId'   => $this->authSource,
             'ReturnTo' => $returnTo,
         ]);