How to hide /nextcloud from url nextcloud 16

hello i’am new in nextcloud and i don’t have much experience !!

i have installed and setup a new nextcloud 16 in my infrastructure everything is working fine
but i have a long url that i want to shorter

my url is : https://mydomain.com/nextcloud/index.php/
i want to have : https://mydomain.com/

i didn’t find anything relevant in the internet i tried so many solutions that never worked you help will be appreciated

thanks

kiko

You have to learn how your ApacheServer or NginxServer works.
You have to use rewrite rules to get rid of /index.php
You have to do a mod in your conf file for having just https://mydomain.com
Look at others Tutorials on how to install Nextcloud, some of them explain how to have /nextcloud or not.

This tutorial can help you on Apache2. It exists for Nginx on this website too

hi Nemskiller thank you for your quick reply and for the link I’ll try to follow the documentation and see if it’ works !!

thank you

kiko

Move youre install out of the subdirectory and put it in youre main directory.
Change everything in de config/config.php and should work.

No the nextcloud folder is right where he is.
It’s apache or nginx to have a conf changed.
Nextcloud can (must) be in /var/www/nextcloud or /var/www/html/nextcloud
The more important is that servername is mydomain.com and the path root is well written.

I setup more then 100 installs, never I put it in a subdirectory.
Offcourse you can edit you’re alias to /var/www/nexcloud (if you use that kind of path)

But if you use a domain name only for NC it can be easier to use the already setup main domain.

Yes but it’s more clear to use folders.
On all my Servers i always have other pages, not just nextcloud.
My www folder look like this (it’s an exemple)
Nextcloud
Matomo
Phpmyadmin
WordPress

This way my www root is empty, it have just folders.

Hello and thank you very much for your reply
Moving to the directory you mean from /vat/www/html/NextCloud. To. /vat/www/HTML right ?

Yes, if /vat/www/html youre main location is, yes.

Dear thijssie85 it’s still not working he ie my config.php

<?php $CONFIG = array ( 'instanceid' => 'xxxxxx', 'passwordsalt' => 'xxxxxxxxxxxxxxxxxxxxxxxxx', 'secret' => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', 'trusted_domains' => array ( 0 => 'xxxxxx', ), 'datadirectory' => '/var/www/nextcloud/data', 'dbtype' => 'mysql', 'version' => '16.0.0.9', 'overwrite.cli.url' => 'http://xxxxxx/', 'dbname' => 'xxxxx', 'dbhost' => 'localhost', 'dbport' => '', 'dbtableprefix' => 'oc_', 'dbuser' => 'xxxxxx', 'dbpassword' => 'xxxxx', 'installed' => true, 'maintenance' => false, 'updater.release.channel' => 'beta', );

image

my apache2.conf

image

Did you enabled the module rewrite for apache ?
a2enmod rewrite

Here is how I would do it:

Leave the path /var/www/nextcloud as is and leave the Nextcloud data in there. Now edit your apache2.conf and change the Directory directive as follows:

FROM

<Directory /var/www/>
        Options FollowSymLinks
        AllowOverride ALL
        Require all granted
</Directory>

TO

<Directory /var/www/nextcloud/>
        Options FollowSymLinks
        AllowOverride ALL
        Require all granted
</Directory>

This change ensures, that whenever you call your domain, it will use the /var/www/nextcloud as main directory (i.e. call any index.{htm,html,php} from that directory)

Please note:
The above solution should only be used, if Nextcloud is the only web application running on your server. If you have other websites / web applications running on your server, you should create another apache.conf and call it nextcloud.conf for example.

Hint:
Best practice with Apache is to create a separate config file for each website / web application without changing the original apache2.conf file.

How you handle your Apache depends on your Linux Distro (Ubuntu, CentOS, Debian, etc.)

1 Like

Yes it’s enable already

Hi CFelix thank you for your reply ijust did the chnages and restart apache2 service but still cannot get rid of /nextcloud
.

image

hi Nemskiller yes it’s already enable
image

here is my nextcloud.conf from /etc/apache2/sites-avilable

Please could you remove the Alias as this is not required and looks kind of like the culprit.

Thank you CFelix for your quick prompt i just change it but still the same should i run occ maintenance ?
`sudo -u apache php occ maintenance:update:htaccess

image
image