• Resolved Joe

    (@timelessbeing)


    I am running WP5.2.2 on Apache, from my domain root. I also have Nextcloud running in mydomain/cloud and I’m having trouble with .htaccess rules. Nextcloud requires some rewrite rules in order to make DAV services discovery work, but if I put them in the same .htaccess file with WP rules, then WP URLs break.

    Is there any way to combine all the rules and make NC + WP coexist peacefully?

    My WP rules:

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>

    My sabreDAV “well-known” URLs

    <IfModule mod_rewrite.c>
      RewriteEngine on
      RewriteRule ^\.well-known/host-meta /cloud/public.php?service=host-meta [QSA,L]
      RewriteRule ^\.well-known/host-meta\.json /cloud/public.php?service=host-meta-json [QSA,L]
      RewriteRule ^\.well-known/webfinger /cloud/public.php?service=webfinger [QSA,L]
      RewriteRule ^\.well-known/carddav /cloud/remote.php/dav/ [R=301,L]
      RewriteRule ^\.well-known/caldav /cloud/remote.php/dav/ [R=301,L]
    </IfModule>

    docs:
    https://docs.nextcloud.com/server/16/admin_manual/issues/general_troubleshooting.html#service-discovery
    https://sabre.io/dav/service-discovery/

Viewing 1 replies (of 1 total)
  • Thread Starter Joe

    (@timelessbeing)

    Fixed it. I simply put the NC rules before the WP ones.

    I also took them out of the ifmodule tags so that it generates an error if that module ever gets disabled.

Viewing 1 replies (of 1 total)
  • The topic ‘htaccess conflict’ is closed to new replies.