Accessing oC from two (/several) distinct directories

9.1.x
webserver_issue

#1

This question relates to the FAQ issue The requested uri(\/login) cannot be processed by the script ‘\/owncloud\/index.php’.

My oC instance has long been available at my.domain/owncloud/. Lately, I've considered moving it to its own sub-domain, e.g., owncloud.my.domain.

However, I'm not the sole user of this instance, and I would like to give users time to acclimate at their own leisure; that is, having it accessible from both addresses for a time.

This is where I run into the issue described in the FAQ; oC's /config/config.php has two directives using mod_rewrite to insure visitors find it in the proper directory inside the web-server's directory tree, namely

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

While making the change to / is easy enough, there's no obvious way of enabling a dual directory structure concurrently. My only thought is to remove those directives and rely solely on my web server's configuration files to Rewrite the address (which I prefer anyway), but I suspect occ might not like that (and I need it to properly set the .htaccess files throughout the instance, not to mention the occasional site maintenance).

Any suggestions?

Server configuration
Operating system: Ubuntu Xenial Server
Web server: Apache 2.4.17
Database: MySQL
PHP version: 7.0.15
ownCloud version (see ownCloud admin page): 9.1.5


#2

This should work:

  1. Remove 'htaccess.RewriteBase' => '/owncloud', from your config/config.php
  2. Run occ maintenance:update:htaccess
  3. Set 'overwrite.cli.url' => 'http://example.com', in your config/config.php

You won't have "index.php-less URLS" with that for the time until you're fully switching to the subdomain.


#3

@kljhlkhglklfgh thanks. Two questions?

  1. What effect does the change to config/config.php have, that's made after running occ?

  2. Perhaps this is related, but after these changes oC rewrites addresses to [owncloud.]my.domain/owncloud/index.php/..., so not only does the address contain index.php, but it also always contains /owncloud/. This makes me suspect that deleting the Alias directive, once I decide to complete the move, will brake my instance. Or, will that perhaps be solved by adding 'htaccess.RewriteBase' => '/' and running occ?


#4

Oh, that was apparently all due to caching on my desktop. Accessing the website from a different machine, oC is accessible from both my.domain/owncloud and owncloud.my.domain/.
(Both do indeed use index.php/ as root directory.)