Title: htaccess conflict
Last modified: August 15, 2019

---

# htaccess conflict

 *  Resolved [Joe](https://wordpress.org/support/users/timelessbeing/)
 * (@timelessbeing)
 * [6 years, 12 months ago](https://wordpress.org/support/topic/htaccess-conflict/)
 * 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://docs.nextcloud.com/server/16/admin_manual/issues/general_troubleshooting.html#service-discovery)
   [http://sabre.io/dav/service-discovery/](http://sabre.io/dav/service-discovery/)

Viewing 1 replies (of 1 total)

 *  Thread Starter [Joe](https://wordpress.org/support/users/timelessbeing/)
 * (@timelessbeing)
 * [6 years, 12 months ago](https://wordpress.org/support/topic/htaccess-conflict/#post-11836363)
 * 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.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 1 participant
 * Last reply from: [Joe](https://wordpress.org/support/users/timelessbeing/)
 * Last activity: [6 years, 12 months ago](https://wordpress.org/support/topic/htaccess-conflict/#post-11836363)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
