Last active
July 2, 2025 12:16
-
-
Save aaronpk/5846789 to your computer and use it in GitHub Desktop.
Added WebFinger support to my email address using one rewrite rule and one static file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[[email protected] www]$ cat .htaccess | |
RewriteEngine on | |
RewriteCond %{QUERY_STRING} resource=acct:(.+) | |
RewriteRule ^\.well-known/webfinger /profile/%1? [L] | |
[[email protected] www]$ cat profile/[email protected] | |
{ | |
"subject": "acct:[email protected]", | |
"links": [ | |
{ | |
"rel": "http://webfinger.net/rel/avatar", | |
"href": "http://aaronparecki.com/images/aaronpk.png" | |
}, | |
{ | |
"rel": "http://webfinger.net/rel/profile-page", | |
"href": "http://aaronparecki.com/" | |
}, | |
{ | |
"rel": "me", | |
"href": "http://aaronparecki.com/" | |
} | |
] | |
} | |
@roseeng According to the spec, the correct test URLs should use
resource=
instead ofprofile=
:* https://fmarier.org/.well-known/webfinger?resource=acct:[email protected] * https://fmarier.org/.well-known/webfinger?resource=acct%3Afrancois%40fmarier.org
Right, I mixed up the url parameter and the folder name. Fixed.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A lot of good info here, unfortunately not in a copy-pastable format (steelman's comment put the profiles in a different subfolder and fmarier accidentally let the dot stay unescaped). Also, with my current provider, it is better to put folder-specific directives in that folder instead of a directive.
So here is my attempt at combining all good ideas from above:
Create a folder called
profile
In it, create a .htaccess file with the following contents:
Also create a file for your profile (named [email protected]).
Fill it with the suitable json (no point in me giving you an example).
Then, in your root folder, add the following at the beginning of your .htaccess file:
If your base folder needs it (i.e. you try it but get a 404) , change the rewrite rule to
And last, you try it by navigating to
https://your-domain.com/.well-known/webfinger?resource=acct:[email protected]
To double-check that url-encoded calls will work, also try fetching
https://your-domain.com/.well-known/webfinger?resource=acct%3Ayour-name%40your-domain.com