Redirect all requests to SSL site + Redirect to canonical domain

Hi,

Everything is working fine, however I found an issue/bug with redirects via Virtualmin:

Under Web Options for the Domain:
The Combined options for “Redirect all requests to SSL site” => “Yes”, and “Redirect to canonical domain” => “non-www to www” causing wrong redirects as follow:

Navigating to:
http : / / DOMAIN . com /
is redirecting 302 to:
https : / / www. DOMAIN . com // DOMAIN . com

The issue is, the DOMAIN name is added to the URL file path, together with a slash prefix.
The URL Path should remain as a single slash “/”.

Expected behavior:

Navigating to:
http : / / DOMAIN.com /
is redirecting 302 to:
https :// www . DOMAIN . com /

(I’m sorry for the spaces in the URL, this forum is limiting the links in the posts, even if they are just an examples)

There’s no .htaccess file under the domain.

Please see the attachments below:

SYSTEM INFORMATION
OS type and version Debian 12
Virtualmin version 7.30.8

are running apache or nginx? you aint supplied all details.

Works fine on my system, I have Apache.
its creates 2 lines in the directives.

I’m using Apache, issue still exists for a real domain, that “example.com” from @stefan1959 is not accurate as the issue happens on a real scenario not just only for a non-existing domain like “example.com” and just directive-checking.

Here are my directives for that domain (nothing edited manually):

When Redirect non-www to www is On there are two lines added, however on a real domain available via web browser the issue persist as described earlier, directives looks good but the real behavior is different.

I did test on a real domain, so not sure why say its not accurate, your screen looks the same to mine, maybe me eyesight is getting bad. (I did nothing manually)
I reduplicated it on a example.com so I could screenshot it.
Maybe check you web log files for why its not working.