[SOLVED] How to redirect to a selfhosted nextcloud-server using a link on my homepage

This is more a question about webhosting-configuration but especially to connect to a nextcloudserver.

The adresses of my routers are very complicated and will change soon so i thought it would be nice if i had a simple link on my homepage that redirects to the complicated server adress.

So when the adress changes - for example when you buy a new router - i only have to change the redirection and all the clients should work properly.

My first attempt was to use a subdomain but unfortunately only my maindomain is SSL-certified, so this dod not work.

So i tried to use a .htaccess in my maindomain and

  • created a file: nextcloud.html
  • created a file: .htaccess
    with the following code:
    Redirect /nextcloud.html http://dyndns-adress_of_my_router.net

This works when i use a browser but when i try to connect by the nextcloud-app (Windows) i get a
“ERROR 400 Bad Request”
“GET www.mydomain.net/nextcloud.html/status.php

Feels a if i was close or is this the absolute wrong way?

The problem is, that most apps see a thread in any kind of “redirected” urls, so you have to take a more direct way.

Use CNAME in the configuration settings of your homepage/webspace and “redirect” a subdomain that way to your selfhosted server.

New problem: It only redirects port 80. Your service has to use this port (fortunately nextcloud does this as default), but if you have more than one service on your server, you need a REVERSE PROXY.

I don’t understand why you’re using .htaccess like that. If you’re going to create a nextcloud.html file, why not just have it contain something like the following:

<meta http-equiv="Refresh" content="0; url='https://dyndns-adress_of_my_router.net'" />

That will redirect to https://dyndns-adress_of_my_router.net after 0 seconds.

Alternatively, you could add a vhosts to your Apache config.

<VirtualHost *:80>
    ServerName easy-to-remember-domain.net
    Redirect permanent / https://dyndns-adress_of_my_router.net/

Does that help?

Hi DarkSteve,
after both of my tries failed, i wanted to ask.
Now i tried your way with a nextcloud.html but it is exactly the same.

When i enter
in the nextcloud-app (windows) it gives
Error 404 not found of
GET https://domain.net/nextcloud.html/nextcloud/status.php

When i enter it with “www”
in the nextcloud-app (windows) it says
secure connection failed and i can choose between

  • Another URL
  • unsecure connection (http) or
  • configure clientside TLS-certificate

There is something wrong, right?