I installed Nextcloud v21 via snap on Ubuntu hosted on my VPS. Now I want to enable Pretty URLs to remove the index.php in the URL. Per their documentation, as a prerequisite to editing the Nextcloud config file:

mod_env and mod_rewrite must be installed on your webserver and the .htaccess must be writable by the HTTP user.

I am very new at this, but I assume this has to do with the Apache settings. However, given this was a snap install, I'm not sure how I make these adjustments. Can someone please offer some guidance on what I need to do?

1 Answer 1


I was looking to do exactly the same thing, although I'm self-hosting on an Odroid, but this simply cannot be done. The way to enable Pretty URLs looks like this.

First you need to edit your config.php and add these values:

'overwrite.cli.url' => 'https://example.org/',
'htaccess.RewriteBase' => '/',

Then you can run the following from the command line (as per the Ubuntu snap):

$ sudo nextcloud.occ maintenance:update:htaccess

Snaps, by design, are read-only so you cannot edit any files in the snap container. The .htaccess file that enables pretty URLs resides in ${SNAP}/htdocs/.htaccess which on my machine is /snap/nextcloud/current/htdocs/.htaccess. As a result, running the maintenance:update:htaccess fails as the Nextcloud CLI cannot update a read-only file.

This issue with the Snap container has existed since 2016 and even as recent as 10 days ago there is no solution or will to fix this.

The lack of fix is because this isn't broken by design. Nextcloud don't enable Pretty URLs by default and the Snap maintainers don't want to enable something Nextcloud don't enable themselves in their Snap.

While I really want pretty URLs, I cannot fault the logic. I am not sure the hack to overcome this warrants the effort.

New contributor
justinhartman is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.