Removing index.php from the Nextcloud URI

sorry for necrobumping this thread, but it may help others, facing the same problem:

  • mod_env enabled
  • mod_rewrite enabled
  • in config.php: 'htaccess.RewriteBase' => '/',
  • .htaccess was successfully written by occ maintenance:update:htaccess

but still having /index.php/

i was able to “quickfix” this by setting 'htaccess.IgnoreFrontController' => true in my config.php (see: Apache rewrite to remove index.php)

but finally, after some investigation, i found the “real” cause: nextcloud is not detecting working mod_env when php-fpm was running as fcgi !

background: with php running as cgi, every request was served via redirect which adds REDIRECT_ to all the variable-names set by SetEnv, like:

SetEnv front_controller_active true

becomes: [REDIRECT_front_controller_active] => true

it seems the nextcloud-check does not take this into account.

the proper solution was enabling the apache Module proxy_fcgi and changing the SetHandler like this:

<FilesMatch "\.php[345]?$">
         SetHandler "proxy:unix:/var/lib/php7-fpm/cloud.sock|fcgi://localhost"
</FilesMatch>

i also removed the lines for Action, Alias, and FastCgiExternalServer regarding the former php7-fcgi handler as they were no longer used.

and voila! the variablenames set via SetEnv in .htaccess stay unchanged, nextcloud recognises the front_controller_active variable -> /index.php/ is gone, without setting htaccess.IgnoreFrontController

1 Like