Remove /owncloud from URL [SOLVED]

doc_answered
9.1.x
help

#1

Please help us by providing the following info. Before posting please also check the pinned "Known issues" threads and make sure that you're running the latest available version for your oC release: https://owncloud.org/changelog/

I am trying to move owncloud to the root folder. I am hoping that this would allow me to access owncloud as example.com instead of example.com/owncloud

I have not been able to find anything helpful about this on here or elsewhere on the internet.

I did manage to run mv /var/www/owncloud* /var/www/
This moved all the files to the www and nothing changed after that.

I am not sure if I need to move the whole folder of owncloud or just the files like I did earlier

When I try to move the folder owncloud I get an error message as described below.

Steps to reproduce
1. open ssh and type in mv /var/www/owncloud/ /var/www
2.
3.

Expected behaviour
Tell us what should happen

hopefully move the owncloud into the www and access the site using example.com instead of example.com/owncloud

Actual behaviour
Tell us what happens instead
I get an error message that says
mv: '/var/www/owncloud/' and '/var/www/owncloud' are the same file
Server configuration
Operating system: ubuntu 16.04 server
Web server:
Database: mysql
PHP version: 7
ownCloud version (see ownCloud admin page): 9.1.1
Updated from an older ownCloud or fresh install: fresh install
Special configuration (external storage, external authentication, reverse proxy, server-side-encryption): none

ownCloud log (data/owncloud.log)

Please paste possible errors in the following code block, see https://central.owncloud.org/t/how-to-find-webserver-or-oc-logfile-enable-php-logfile/808 for more info

Integrity status for oC9+

Login as admin user into your ownCloud and access
http://example.com/index.php/settings/integrity/failed
paste the results here.

none


#2

To move to files try mv /var/www/owncloud/* /var/www/ and remove the empty owncloud folder afterwards. Note the "/" after owncloud.

You tried to move the owncloud folder (or to be precise everything starting with owncloud) to /var/www where it already was.


#3

Thanks for the reply

I did that method and it moved the files of owncloud into the www dir and left the owncloud folder in www but didnt move the .htaccess for some reason.

This did not work for loading anything

Is this what needs to be done to get the site to work as example.com and not example.com/owncloud? or do I need to move the owncloud dir with contents inside of it to www?


#4

Hi,

if you have used the packages / repositories (which the /var/www/owncloud indicates) please be aware of this big red warning:

Do not move the folders provided by these packages after the
installation, as this will break updates.

https://doc.owncloud.org/server/latest/admin_manual/installation/linux_installation.html

Besides that moving the datadir (/var/www/owncloud/data) after the installation to another place is currently not supported and will most likely break your installation (See: https://github.com/owncloud/documentation/issues/2303).

Finally a documentation how to make the ownCloud installation available at example.com instead of example.com/owncloud is available here:

https://doc.owncloud.org/server/latest/admin_manual/installation/changing_the_web_route.html


#5

May be I missed something, but if you want to change the url of your owncloud installation you need to modify your virtualhost, not the place where the files are. It doesn't matter where the files are. Moving the files, will only break your installation as mentionned by RealRancor.
I suppose your webserver is Apache. Thus you have to modify the settings in the file where your virtualhost is defined in /etc/apache2/sites-available. Most likely a file named defautxxxx.conf
And don't forget to restart (or reload) your web server to activate the modifications.


#6

ya I would rather change the ii through apache .... but honestly I am not sure how to do it. I found a way to redirect through PHP but it was slow.

Actually moving the owncloud files to html works. Then I moved the data folder to the home dir and updated the directory path and the error went away.

but that is just on my test one ..for my main one I would like to do it by the redirect. So far anything I have I tried does not work. I have been looking for how to for days now and I cant seem to find anything that is real helpful yet on what to put for the redirect


#7

Hi,

based on your reply i'm assuming that you havn't read my previous comment / post above:


#8

Hey @RealRancor Thanks for the post. I love you! You have ended my daily search on how to remove the /owncloud from the url successfully. I had a lot typed up for a question but Im going to leave it here as a bit of clarification if anyone else tries to do this

The first one at: sudo nano /etc/apache2/conf-enabled/owncloud.conf

At the top of the entry.

I changed it from:

 Alias /owncloud "/var/www/owncloud/"

to

 Alias / "/var/www/owncloud/"

Then at: sudo nano /var/www/owncloud/config/config.php

Changed it from:

'overwrite.cli.url' => 'http://example.com/',

to

'overwrite.cli.url' => 'http://localhost/',

This is where I wasnt real sure what to do

Then at Edit the file: sudo nano /var/www/owncloud/.htaccess

...
#### DO NOT CHANGE ANYTHING ABOVE THIS LINE ####
...
<IfModule mod_rewrite.c>
  RewriteBase /
...

I get this

<IfModule mod_rewrite.c>
  RewriteEngine on
  RewriteRule .* - [env=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
  RewriteRule ^\.well-known/host-meta /public.php?service=host-meta [QSA,L]
  RewriteRule ^\.well-known/host-meta\.json /public.php?service=host-meta-json $
  RewriteRule ^\.well-known/carddav /remote.php/dav/ [R=301,L]
  RewriteRule ^\.well-known/caldav /remote.php/dav/ [R=301,L]
  RewriteRule ^remote/(.*) remote.php [QSA,L]
  RewriteRule ^(?:build|tests|config|lib|3rdparty|templates)/.* - [R=404,L]
  RewriteCond %{REQUEST_URI} !^/.well-known/acme-challenge/.*
  RewriteRule ^(?:\.|autotest|occ|issue|indie|db_|console).* - [R=404,L]
</IfModule>

Go to the very bottom of the entry until you see

#### DO NOT CHANGE ANYTHING ABOVE THIS LINE ####

It literally goes at the very bottom of the entry like this:

#### DO NOT CHANGE ANYTHING ABOVE THIS LINE ####
<IfModule mod_rewrite.c>
  RewriteBase /

now my entry also had this under the: DO NOT CHANGE ANYTHING ABOVE THIS LINE

ErrorDocument 403 /owncloud/core/templates/403.php
ErrorDocument 404 /owncloud/core/templates/404.php

So I ended up with this:

#### DO NOT CHANGE ANYTHING ABOVE THIS LINE ####
<IfModule mod_rewrite.c>
  RewriteBase /
ErrorDocument 403 /owncloud/core/templates/403.php
ErrorDocument 404 /owncloud/core/templates/404.php

Then at the very end I needed to restart Apache with: sudo systemctl reload apache2

now when I type in example.com it will take me to https://example.com and not https://example.com/owncloud.

Note: the HTTPS setting is something different and this will not enable HTTPS