diff --git a/apps/remoteStorage/appinfo/info.xml b/apps/remoteStorage/appinfo/info.xml
index 121587795dbf7162838ecdd38493f89395be4b52..1ab55e8c094a8d0b51b0f9aa36193dac96b1f4af 100644
--- a/apps/remoteStorage/appinfo/info.xml
+++ b/apps/remoteStorage/appinfo/info.xml
@@ -3,7 +3,7 @@
 	<id>remoteStorage</id>
 	<name>remoteStorage compatibility</name>
 	<description>Enables your users to use ownCloud as their remote storage for unhosted applications.</description>
-	<version>0.5</version>
+	<version>0.6</version>
 	<licence>AGPL or MIT</licence>
 	<author>Michiel de Jong</author>
 	<require>2</require>
diff --git a/apps/remoteStorage/appinfo/webfinger.php b/apps/remoteStorage/appinfo/webfinger.php
new file mode 100644
index 0000000000000000000000000000000000000000..bb3fe1681b3e9f2f9839ab9b8d1b5d725d220905
--- /dev/null
+++ b/apps/remoteStorage/appinfo/webfinger.php
@@ -0,0 +1,6 @@
+    <Link
+        rel="remoteStorage"
+        template="<?php echo WF_ROOT; ?>/apps/remoteStorage/WebDAV.php/<?php echo WF_USER; ?>/remoteStorage/{category}/"
+        api="WebDAV"
+        auth="<?php echo WF_ROOT; ?>/apps/remoteStorage/auth.php/<?php echo WF_USER; ?>">
+    </Link>
diff --git a/apps/user_webfinger/.htaccess b/apps/user_webfinger/.htaccess
deleted file mode 100644
index 4d4d2e9c58f6ae0526fddd7c1b8425c25c9bb06d..0000000000000000000000000000000000000000
--- a/apps/user_webfinger/.htaccess
+++ /dev/null
@@ -1,3 +0,0 @@
-RewriteEngine On
-RewriteBase /
-RewriteRule host-meta$ \/\.well-known\/host-meta\.php [L]
diff --git a/apps/user_webfinger/appinfo/info.xml b/apps/user_webfinger/appinfo/info.xml
index 55cf2cf2201d08e448a9e419782db41bc98d7e62..d47fb723a3af1aa1aeeec20fc194008d8d6ef7aa 100644
--- a/apps/user_webfinger/appinfo/info.xml
+++ b/apps/user_webfinger/appinfo/info.xml
@@ -2,9 +2,9 @@
 <info>
 	<id>user_webfinger</id>
 	<name>Webfinger</name>
-	<description>Provide WebFinger for all users so they get a user address like user@owncloudinstance which can be used for unhosted applications. If you don't run ownCloud in the root of your domain, for instance if you run it on example.com/owncloud/, then make sure you link example.com/.well-known/ to example.com/owncloud/apps/user_webfinger/ - by running something like "ln -s /var/www/owncloud/apps/user_webfinger /var/www/.well-known". Only enable this app if you run this ownCloud installation on a public web address, not if you run it on an intranet or on localhost.</description>
-	<version>0.2</version>
+	<description>Provide WebFinger for all users so they get a user address like user@owncloudinstance which can be used for external applications. Other apps can provide information for webfinger requests, such as remoteStorage compatibility.</description>
+	<version>0.3</version>
 	<licence>AGPL or MIT</licence>
-	<author>Michiel de Jong</author>
+	<author>Michiel de Jong, Florian Hülsmann</author>
 	<require>2</require>
 </info>
diff --git a/apps/user_webfinger/host-meta b/apps/user_webfinger/host-meta
deleted file mode 100644
index dfaf3636145a5f3c91c115762884944be4445ba4..0000000000000000000000000000000000000000
--- a/apps/user_webfinger/host-meta
+++ /dev/null
@@ -1 +0,0 @@
-please run 'a2enmod rewrite' on your server, set 'AllowOverride All' for /var/www in /etc/apache2/sites-enabled/000-default or equivalent, and then run '/etc/init.d/apache2 restart'
diff --git a/apps/user_webfinger/host-meta.php b/apps/user_webfinger/host-meta.php
deleted file mode 100644
index ac577cf9a0c4526dc7315061fd5247f18803f608..0000000000000000000000000000000000000000
--- a/apps/user_webfinger/host-meta.php
+++ /dev/null
@@ -1,16 +0,0 @@
-<?php
-if($_SERVER['SCRIPT_NAME'] == '/.well-known/host-meta.php') {
-	header("Access-Control-Allow-Origin: *");
-} else {
-	header('Please-first: activate');
-}
-header("Content-Type: application/xrd+xml");
-echo "<";
-?>
-?xml version="1.0" encoding="UTF-8"?>
-<XRD xmlns="http://docs.oasis-open.org/ns/xri/xrd-1.0" xmlns:hm="http://host-meta.net/xrd/1.0">
-	<hm:Host xmlns="http://host-meta.net/xrd/1.0"><?php echo $_SERVER['SERVER_NAME'] ?></hm:Host>
-	<Link rel="lrdd" template="http<?php echo (isset($_SERVER['HTTPS'])?'s':''); ?>://<?php echo $_SERVER['SERVER_NAME'] ?>/.well-known/webfinger.php?q={uri}">
-	</Link>
-</XRD>
-
diff --git a/apps/user_webfinger/webfinger.php b/apps/user_webfinger/webfinger.php
index 5c2a24aa0707fd8bfb0aeddfcfa7b98d986f0d74..ecbfeed8e4b82e9aee2cae2f7add0523bdc04e6c 100644
--- a/apps/user_webfinger/webfinger.php
+++ b/apps/user_webfinger/webfinger.php
@@ -1,41 +1,68 @@
 <?php
-if($_SERVER['SCRIPT_NAME'] == '/.well-known/webfinger.php') {
-	header("Access-Control-Allow-Origin: *");
-} else {
-	header('Please-first: activate');
-}
+header("Access-Control-Allow-Origin: *");
 header("Content-Type: application/xrd+xml");
 
+/**
+ * To include your app in the webfinger XML, add a new script with file name
+ * 'webfinger.php' to /apps/yourapp/appinfo/, which prints out the XML parts
+ * to be included. That script can make use of the constants WF_USER (e. g.
+ * "user"), WF_ADDRESS ("user@host") and WF_ROOT ("https://host/owncloud").
+ * An example could look like this:
+ * 
+ * <Link
+ * 	rel="myProfile"
+ * 	type="text/html"
+ * 	href="<?php echo WF_ROOT; ?>/apps/myApp/profile.php?user=<?php echo WF_USER; ?>">
+ * </Link>
+ *
+ '* but can also use complex database queries to generate the webfinger result
+ **/
 // calculate the documentroot
 // modified version of the one in lib/base.php that takes the .well-known symlink into account
-$DOCUMENTROOT=realpath($_SERVER['DOCUMENT_ROOT']);
+/*$DOCUMENTROOT=realpath($_SERVER['DOCUMENT_ROOT']);
 $SERVERROOT=str_replace("\\",'/',dirname(dirname(dirname(dirname(__FILE__)))));
 $SUBURI=substr(realpath($_SERVER["SCRIPT_FILENAME"]),strlen($SERVERROOT));
 $WEBROOT=substr($SUBURI,0,-34);
+*/
+require_once('../../lib/base.php');
 
+$id = $_GET['q'];
 if($_GET['q']) {
 	$bits = explode('@', $_GET['q']);
 	$userName = $bits[0];
 } else {
+	$id = '';
 	$userName = '';
 }
 if(substr($userName, 0, 5) == 'acct:') {
 	$userName = substr($userName, 5);
 }
 if(isset($_SERVER['HTTPS'])) {
-	$baseAddress = 'https://'.$_SERVER['SERVER_NAME'].'/apps/remoteStorage/';
+	$baseAddress = 'https://';
 } else {
-	$baseAddress = 'http://'.$_SERVER['SERVER_NAME'].'/apps/remoteStorage/';
+	$baseAddress = 'http://';
 }
+$baseAddress .= $_SERVER['SERVER_NAME'].OC::$WEBROOT;
+define('WF_USER', $userName);
+define('WF_ADDRESS', $id);
+define('WF_ROOT', $baseAddress);
 echo "<";
 ?>
 ?xml version="1.0" encoding="UTF-8"?>
 <XRD xmlns="http://docs.oasis-open.org/ns/xri/xrd-1.0" xmlns:hm="http://host-meta.net/xrd/1.0">
-	<hm:Host xmlns="http://host-meta.net/xrd/1.0"><?php echo $_SERVER['SERVER_NAME'] ?></hm:Host>
-	<Link
-		rel="remoteStorage"
-		template="<?php echo $baseAddress ?>WebDAV.php/<?php echo $userName ?>/remoteStorage/{category}/"
-		api="WebDAV"
-		auth="<?php echo $baseAddress; ?>auth.php/<?php echo $userName ?>"
-	></Link>
+	<hm:Host xmlns="http://host-meta.net/xrd/1.0"><?php echo $_SERVER['SERVER_NAME']; ?></hm:Host>
+    <Subject>acct:<?php echo $userName . '@' . $_SERVER['SERVER_NAME'] ?></Subject>
+<?php
+$apps = OC_Appconfig::getApps();
+foreach($apps as $app) {
+	//echo "checking $app...\n";
+	if(OC_App::isEnabled($app)) {
+		//echo "is enabled\n";
+		if(is_file(OC::$APPSROOT . '/apps/' . $app . '/appinfo/webfinger.php')) {
+			//echo "has webfinger.php\n";
+			require($app . '/appinfo/webfinger.php');
+		}
+	}
+}
+?>
 </XRD>