Are you using a Self Signed Certificate? I also followed this instructions Remove /index.php/ from the url until I realized I was using the SSL website so I just add the code to the apache virtual host, in my case nextcloud-ssl.conf
config.php file:
<?php $CONFIG = array ( 'htaccess.RewriteBase' => '/', Apache for both virtual hosts: Options +FollowSymlinks AllowOverride All Dav off SetEnv HOME /var/www/nextcloud SetEnv HTTP_HOME /var/www/nexcloud Satisfy Any