Skip to content

Remove index.php from NextCloud urls

By default NextCloud has index.php in the urls, it’s not a show stopper at all but it’s good to have nice clean urls when sharing.

Tested on NextCloud 11 Ubuntu 16.04.1 server.

Login to your server and check 1st if rewrite module is enabled.

apachectl -M

If not, enable it with env module by below command:

a2enmod rewrite
a2enmod mod_env

I assume you have installed nextcloud in /var/www/nextcloud. Just to make sure the .htaccess file has correct owner and group.

chown www-data:www-data /var/www/nextcloud/.htaccess

Now we will add one line of code to config.php:

vim /var/www/nextcloud/config/config.php

Add the following line to $CONFIG array:

'htaccess.RewriteBase' => '/',

Now let’s update the htaccess file by occ:

cd /var/www/html
sudo -u www-data php occ maintenance:update:htaccess

By running the above command it will add rewrite code to htaccess file.

Restart apache(necessary if rewrite was not enabled before):

systemctl restart apache2

That’s pretty much it.

Published inLinuxPHPUbuntu

Leave a Reply

1 Comment threads
0 Thread replies
Most reacted comment
Hottest comment thread
1 Comment authors
Fixticks Recent comment authors

This site uses Akismet to reduce spam. Learn how your comment data is processed.

newest oldest most voted
Notify of

This worked for me, thanks.

Theme by Compete Themes. Enhanced for The Random Bits only. © The Random Bits 2018.