# Nextcloud Redirecting to Wrong URL / Wrong Port

**URL:** <https://help.nextcloud.com/t/nextcloud-redirecting-to-wrong-url-wrong-port/106486>\
**Category:** ℹ️ Support\
**Created:** [February 2, 2021, 3:50am UTC](https://help.nextcloud.com/t/nextcloud-redirecting-to-wrong-url-wrong-port/106486 "2021-02-02T03:50:20Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![yupthatguy](https://help.nextcloud.com/letter_avatar/yupthatguy/32/5_5575768a8748004e209b776fc1b2916d.png) [@yupthatguy](https://help.nextcloud.com/u/yupthatguy)\
**Post date:** [February 2, 2021, 3:50am UTC](https://help.nextcloud.com/t/nextcloud-redirecting-to-wrong-url-wrong-port/106486/1 "2021-02-02T03:50:20Z")

</div>

I just manually installed NextCloud 20.0.5.2 on a local machine running Ubuntu 20.04 LTS, at /var/www/html/nextcloud . I have everything setup and working well with a self-signed OpenSSL certificate for my development LAMP.

My problem is that while logged in, if I click the nextcloud logo in top left corner, to return to the dashboard. (When I mouseover the logo, I actually see the correct https url )

I am instead redirected to the http NOT the https url for the nextcloud dashboard, resulting in an internal server error. INCORRECTLY, stating that I am trying to access myncsite\< .com\> on Port 80

NOTE: the same error occurs when I logout of nextcloud via the upper right menu… The error also happens when I login… requiring me to manually enter https at the beginning of the url in order to reach the dashboard

In reality, my nextcloud site is located at \<h ttps://\>myncsite\<.com\> on Port 443

My nextcloud.conf file also says \<VirtualHost \*:443\>

And in my /var/www/html/nextcloud/config/config.php file I have the following options set:

‘trusted\_domains’ =\>  
array (  
0 =\> ‘127.0.0.1’,  
1 =\> ‘myncsite\<.com\>’,  
2 =\> ‘\<h ttps://\>myncsite\<.com\>’,  
),

‘overwrite.cli.url’ =\> ‘\<h ttps://\>myncsite\<.com\>/’,

How do I get Nextcloud to remain on the correct https url and port?

Thx

---

<div class="post-metadata">

**Author:** ![wwe](https://help.nextcloud.com/user_avatar/help.nextcloud.com/wwe/32/72963_2.png) [@wwe](https://help.nextcloud.com/u/wwe)\
**Post date:** [February 2, 2021, 9:02am UTC](https://help.nextcloud.com/t/nextcloud-redirecting-to-wrong-url-wrong-port/106486/2 "2021-02-02T09:02:50Z")

</div>

I’m using this 2 variables in my config:  
OVERWRITEHOST OVERWRITEPROTOCOL=https  
I see no issues so far. See [https://docs.nextcloud.com/server/stable/admin\_manual/configuration\_server/reverse\_proxy\_configuration.html](https://docs.nextcloud.com/server/stable/admin_manual/configuration_server/reverse_proxy_configuration.html) for detailed explanation.

---

<div class="post-metadata">

**Author:** ![yupthatguy](https://help.nextcloud.com/letter_avatar/yupthatguy/32/5_5575768a8748004e209b776fc1b2916d.png) [@yupthatguy](https://help.nextcloud.com/u/yupthatguy)\
**Post date:** [February 2, 2021, 9:42am UTC](https://help.nextcloud.com/t/nextcloud-redirecting-to-wrong-url-wrong-port/106486/3 "2021-02-02T09:42:02Z")

</div>

hey hey… I used ‘overwriteprotocol’ =\> ‘https’, and everything works like a charm now.

thx

---

<div class="post-metadata">

**Author:** ![system](https://help.nextcloud.com/user_avatar/help.nextcloud.com/system/32/29333_2.png) [@system](https://help.nextcloud.com/u/system)\
**Post date:** [September 23, 2024, 4:34pm UTC](https://help.nextcloud.com/t/nextcloud-redirecting-to-wrong-url-wrong-port/106486/4 "2024-09-23T16:34:18Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.

---

<div class="post-metadata">

**Author:** ![wwe](https://help.nextcloud.com/user_avatar/help.nextcloud.com/wwe/32/72963_2.png) [@wwe](https://help.nextcloud.com/u/wwe)\
**Post date:** [December 13, 2024, 6:36am UTC](https://help.nextcloud.com/t/nextcloud-redirecting-to-wrong-url-wrong-port/106486/5 "2024-12-13T06:36:30Z")

</div>


