Code Integrity Check failed for required change in .htaccess

Nextcloud 18.03 on ubuntu 18.04 in vuirtual box, and all was perfect.

In admin,settings overview I now see the dreaded warning about failing integrity check, and .htaccess is being flagged…

To enable or fix something showing up in the same place a month ago ( dont remember exactly)
I read I needed to prepend a bunch of lines in htaccess, under as shown

RewriteRule ^.well-known/webfinger /public.php?service=webfinger [QSA,L]

to

RewriteRule ^.well-known/webfinger /nextcloud/public.php?service=webfinger [QSA,L]

What ever I was working on, prepending the dir as above to a few lines cleared up any complaints and for at least a month gazed in sheer delight and amazement that NC said everything looks great.

Now NC 18.04 is out, went to update and boom. htaccess is problem.
If I replace it with a backed up copy, what ever required me to change the file will break,
kind of in a catch 22 here…

Tried to run occ maintenance:update:htaccess hoping the hash would get updated but no luck…
also tried to disable the integrity check in config.php, but the updater still complained.

Any help will be greatly appreciated !

I think because I have NC not in the servers root but in a nextcloud sub-folder ,
I had to update a few lines in so rewrite’s would work.

Looking around, I believe I was trying to squash the “Your web server is not properly set up to resolve “/.well-known/caldav”. messages”

See the NC directions on how to fix…
https://docs.nextcloud.com/server/17/admin_manual/issues/general_troubleshooting.html#service-discovery

I guess I need to expand this now.
#1 if this is official documentation, than its wrong. Once you edit the file, NC complains…

SO, Im guessing that I should change my default-ss.conf so nc wont complain about an altered .htaccess file…

Its only a guess, and im not 100% sure of how, can ANYONE help ?

Solved by NOT following the NC documentation.
Creating .htacess as recomended in the servers ROOT, restarting apahce2 had
no effect…

In 000-default.conf I added lines between </VirtualHost> and </IfModule> :

Redirect 301 /.well-known/carddav /nextcloud/remote.php/dav
Redirect 301 /.well-known/caldav /nextcloud/remote.php/dav

Now original .htaccess is passing validation and im not receiving resolving errors