Ideas on what I can put in place to not show the Nethserver webpage when no port is used

webserver

(Charles) #1

Hello Team,

I have Nethserver installed and used as our Domain Controller and Nextcloud system in our office. If I put in the port to login to Nethserver or add in /Nextcloud to the FQDN I obviously get to the right login page. But if no port or full name is given I see the Nethserver landing page that says I’m running Nethserver.

I see that I can add a page to /var/www/html/ directory. How can I force the login page to go to NexCloud if someone doesn’t put in the correct full website name? So if my website is https://mysite.com:8443/nextcloud and someone puts in https://mysite.com:8443 only they are still redirected to my Nextcloud site?

Thanks.


(Michael Träumner) #2

I think you can do it with a html-redirection. The code of the site you have to safe as /var/www/html/ should look like the following:

<!DOCTYPE HTML>
<html lang="en-US">
    <head>
        <meta charset="UTF-8">
        <meta http-equiv="refresh" content="0; url=https://mysite.com:8443/nextcloud">
        <script type="text/javascript">
            window.location.href = "https://mysite.com:8443/nextcloud"
        </script>
        <title>Page Redirection</title>
    </head>
    <body>
        <!-- Note: don't tell people to `click` the link, just tell them that it is a link. -->
        If you are not redirected automatically, follow this <a href='https://mysite.com:8443/nextcloud'>link to https://mysite.com:8443/nextcloud</a>.
    </body>
</html>

(Charles) #3

Thank you @m.traeumner for your helpful response.

Do I name this file in /var/www/html something like redirect.html? I’m assuming the extension of the file I create here is an .html page.

Does the html service need to be restarted or is it best to have the whole Nethserver restarted?

Thank you.


(Michael Träumner) #4

I think it schould be index.html.


(Charles) #5

Excellent suggestions @m.traeumner. My problem is solved. Much appreciated!


(Bogdan Costin) #6

You can also use a .htaccess to redirect
See here https://mediatemple.net/community/products/grid/204643080/how-do-i-redirect-my-site-using-a-htaccess-file