Redirect https://domain.tld to https://www.domain.tld does not work for nextcloud folder ONLY

Hi everyone,

I absolutely need the nextcloud users being redirected to the www because of social Login with google which does not recognize without the www. Thanks to everyone who can help with this issue.

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face: is for home/non-enterprise users. If you’re running a business, paid support can be accessed via where we can ensure your business keeps running smoothly.

In order to help you as quickly as possible, before clicking Create Topic please provide as much of the below as you can. Feel free to use a pastebin service for logs, otherwise either indent short log examples with four spaces:


Or for longer, use three backticks above and below the code snippet:


Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can :heart:

Nextcloud version (eg, 12.0.2): 14.0.3
Operating system and version (eg, Ubuntu 17.04): Web Hosting (infomaniak)
Apache or nginx version (eg, Apache 2.4.25): 2.4.34
PHP version (eg, 7.1): 7.1

The issue you are facing:

First things, I already edited the .htaccess in the root folder with the following lines:

Rewritecond %{HTTP_HOST} ^$
Rewriterule ^(.*)$1 [QSA,L,R=301] 

It works great everywhere else (basically a wordpress blog and pages). But NOT for the nextcloud folder : If I just type, it just redirects to (no www)

Is this the first time you’ve seen this error? (Y/N): N

Steps to replicate it:

  1. type in the URL bar
  2. Not redirected to

The output of your Nextcloud log in Admin > Logging:

 Nothing relevant

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

  array (
    0 => '',
    1 => '',
    'datadirectory' => '/web/nuage/data',
    'overwrite.cli.url' => '',
    'dbtype' => 'mysql',
    'version' => '',

The output of your Apache/nginx/system log in /var/log/____:

 Nothing relevant