Last active
August 23, 2024 23:52
-
-
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 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/" | |
} | |
] | |
} | |
@sorenpeter asked:
Should there be a file or folder called
webfinger
in the.well-known
folder?
No, the RewriteCond
and RewriteRule
tells Apache, "when somebody asks for /.well-known/webfinger?resource=acct:SOMETHING
, instead serve them /profile/SOMETHING
". This then allows you to store static files in /profile/...
for each user account represented by webfinger and it pretty-much "just works".
If the rules are working properly, you'll never need an actual file at /.well-known/webfinger
.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Should there be a file or folder called
webfinger
in the.well-known
folder?