Skip to content

Commit 7efe6df

Browse files
committed
docs: clarify htaccess.RewriteBase is a backend path, not public URL
The previous description implied the value should mirror the public URL, causing users behind a reverse proxy to misconfigure the setting and hit infinite redirect loops. The value is an Apache RewriteBase directive and must reflect where Nextcloud is served on the backend (relative to DocumentRoot), not the public-facing URL prefix. Split into "Direct setup" and "Reverse proxy" sections with a concrete example of each, and added a matching note in the Pretty URLs section of the source installation guide. Fixes #13428 Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
1 parent fdf5de2 commit 7efe6df

2 files changed

Lines changed: 34 additions & 15 deletions

File tree

admin_manual/configuration_server/config_sample_php_parameters.rst

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1352,19 +1352,28 @@ htaccess.RewriteBase
13521352

13531353
To have clean URLs without ``/index.php``, this parameter needs to be configured.
13541354

1355-
This parameter will be written as "RewriteBase" on update and installation of
1356-
Nextcloud to your ``.htaccess`` file. While this value is often simply the URL
1357-
path of the Nextcloud installation, it cannot be set automatically properly in
1358-
every scenario and needs thus some manual configuration.
1359-
1360-
In a standard Apache setup, this usually equals the folder that Nextcloud is
1361-
accessible at. So if Nextcloud is accessible via ``https://mycloud.org/nextcloud``,
1362-
the correct value would most likely be ``/nextcloud``. If Nextcloud is running
1363-
under ``https://mycloud.org/``, then it would be ``/``.
1364-
1365-
Note that the above rule is not valid in every case, as there are some rare setup
1366-
cases where this may not apply. However, to avoid any update problems, this
1367-
configuration value is explicitly opt-in.
1355+
This parameter will be written as ``RewriteBase`` on update and installation of
1356+
Nextcloud into your ``.htaccess`` file. The value must be the path relative to
1357+
Apache's DocumentRoot where Nextcloud is served on the backend, not necessarily
1358+
the public URL prefix. In most direct (non-proxied) setups these are the same,
1359+
but they differ when a reverse proxy rewrites the URL path.
1360+
1361+
**Direct Apache setup (no reverse proxy)**
1362+
1363+
The URL subpath matches the DocumentRoot-relative path, so use the URL subpath:
1364+
1365+
- Nextcloud at ``https://mycloud.org/nextcloud`` → ``/nextcloud``
1366+
- Nextcloud at ``https://mycloud.org/`` → ``/``
1367+
1368+
**Reverse proxy setup**
1369+
1370+
Use the path where Apache physically serves Nextcloud on the backend server,
1371+
not the public URL prefix. For example, if a reverse proxy forwards
1372+
``https://domain.com/nextcloud/`` to ``http://localhost:8080/`` and Nextcloud
1373+
is installed at the Apache DocumentRoot on the backend server, the correct
1374+
value is ``/``, not ``/nextcloud``.
1375+
1376+
However, to avoid update problems, this configuration value is explicitly opt-in.
13681377

13691378
After setting this value, run ``occ maintenance:update:htaccess``. Now, when the
13701379
following conditions are met, Nextcloud URLs won't contain ``index.php``:

admin_manual/installation/source_installation.rst

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,18 @@ if your setup is available on ``https://example.org/nextcloud`` or::
191191
'overwrite.cli.url' => 'https://example.org/',
192192
'htaccess.RewriteBase' => '/',
193193

194-
if it isn't installed in a subfolder. Finally run this occ-command to update
195-
your .htaccess file::
194+
if it isn't installed in a subfolder.
195+
196+
.. note::
197+
198+
``htaccess.RewriteBase`` must match the path relative to Apache's DocumentRoot
199+
where Nextcloud is served on the backend, not the public URL prefix. In a direct
200+
Apache setup these are identical. Behind a reverse proxy that strips the URL
201+
prefix — for example ``https://domain.com/nextcloud/`` forwarded to
202+
``http://localhost:8080/`` — the correct value is ``/`` even though the public
203+
URL contains ``/nextcloud``.
204+
205+
Finally run this occ-command to update your ``.htaccess`` file::
196206

197207
sudo -E -u www-data php /var/www/nextcloud/occ maintenance:update:htaccess
198208

0 commit comments

Comments
 (0)