diff --git a/www/module.php b/www/module.php
index e07a8711053df6d3a1e4554b642fcf9b6534f83f..c75ec081a044a2d53a598ee6931fcbef6f013a2c 100644
--- a/www/module.php
+++ b/www/module.php
@@ -50,6 +50,11 @@ try {
 	$url = $_SERVER['PATH_INFO'];
 	assert('substr($url, 0, 1) === "/"');
 
+	/* Clear the PATH_INFO option, so that a script can detect whether it is called
+	 * with anything following the '.php'-ending.
+	 */
+	unset($_SERVER['PATH_INFO']);
+
 	$modEnd = strpos($url, '/', 1);
 	if ($modEnd === FALSE) {
 		/* The path must always be on the form /module/. */
@@ -80,6 +85,24 @@ try {
 
 	$path = SimpleSAML_Module::getModuleDir($module) . '/www/' . $url;
 
+	/* Check for '.php/' in the path, the presence of which indicates that another php-script
+	 * should handle the request.
+	 */
+	for ($phpPos = strpos($path, '.php/'); $phpPos !== FALSE; $phpPos = strpos($path, '.php/', $phpPos + 1)) {
+
+		$newPath = substr($path, 0, $phpPos + 4);
+		$paramPath = substr($path, $phpPos + 4);
+
+		if (is_file($newPath)) {
+			/* $newPath points to a normal file. Point execution to that file, and
+			 * save the remainder of the path in PATH_INFO.
+			 */
+			$path = $newPath;
+			$_SERVER['PATH_INFO'] = $paramPath;
+			break;
+		}
+	}
+
 	if ($path[strlen($path)-1] === '/') {
 		/* Path ends with a slash - directory reference. Attempt to find index file
 		 * in directory.