Matrix Federation


run a nextcloud instance on This domain is also used as my matrix-domain. The matrix server itself runs on
For the federation to work, I have to place a file, that tells clients where to find the right matrix server address for the domain:


Can someone give me a hint, how to modify the apache config, so that this file will always be publicly availabe?

right now, I will be redirected to nc login.

Thanks for your help!

You should ask Matrix themselves about this since it isn’t specific to Nextcloud. :+1:

Try their main chat, or search their room listings for other support channels:

Also, try internet searching for your federation /var/www/html/.well-known/matrix/server issue. Seems it is covered in setup documentation online. Says you must add a srv record to index.html

Try following the documentation directions and confirm you’ve gotten SSL working on your matrix subdomain, then adding the serv record to index.html and then checking whether federation works.

I don’t know matrix, but i would try to create a virtual host pointing with on port 80 to the file needed. It’s like the vHost you should have created for your nextcloud in /etc/apache2/sites/available.

Hi ,
the file is configures correctly. I need help with the mod_rewrite

in the .htaccess I found these two line, that effect the behavior of the Directory:

RewriteRule ^(?:.(?!well-known)|autotest|occ|issue|indie|db_|console).* - [R=404,L]
RewriteCond %{REQUEST_URI} !^/.well-known/(acme-challenge|pki-validation)/.*

I tried to exclude the file with
RewriteCond %{REQUEST_FILENAME} !^/.well-known/matrix/server$

no success

I also tried to alter:
RewriteCond %{REQUEST_URI} !^/.well-known/(acme-challenge|pki-validation|matrix)/.*

seems, that I am missing something in the apache config…

Like the robots.txt at is accessible without prior login.

Perhaps you can set a rewrite rule at the beginning to exclude rewrite for your special file.
Please test its with a simple file like “test.html”.

RewriteCond %{REQUEST_URI} !^/pureplantessentials\.html$ 

html - How to exclude a specific file from a rewriterule - Stack Overflow

I tried to add this before all Rewrite Rules.

RewriteCond %{REQUEST_URI} ^/\.well-known/matrix/server$ 
RewriteRule - [L]

If the specific file is requested, then do nothing and make it the [L]ast rule, that is applied.

No success :frowning: