NethServer Version: 7.3
I know I can setup in apache webpage redirects, but I am unsure if I do it if it will be overwritten by any NS updates. Is there a way to do the following in the NS web interface, or is there a supported way to do this where it will not be overwritten.
I have a public domain name office.mydomain.com, which also has the 2 aliases cloud.mydomain.com, and webmail.mydomain.com.
I have NextCloud and WebTop installed, but I want to use the aliases for users to access.
So, I would like to redirect the following when entered;
webmail.mydomain.com --> office.mydomain.com/webtop
cloud.mydomain.com --> office.mydomain.com/nextcloud
Could you please show the full file where you setup the redirect?
If you put files in /etc/httpd/conf.d you should be fine.
Remember to put the files in the backup-config.
Actually, I could use a little help,
I think I need to add a conf file to /etc/httpd/conf.d, which I did, I created a _redirect.conf file containing the following;
<Directory />
AllowOverride All
</Directory>
And, then I am lost, I think I have to create an .htaccess file in the root, (/var/www/httpd/), but I tried that and I get This site can’t be reached, and I have to remove my /etc/httpd/confi.d/_redirect.conf file to load the original NS page again.
In my /var/www/html/.htaccess I had the following, but I think it is not the problem;
Redirect 301 / https://office.mydomain.com/webtop
Although I am also not sure how to redirect to /nextcloud as well, based on what prefix they entered.
apache is well documented https://httpd.apache.org/docs/2.4/rewrite/remapping.html. IMHO you can do that directly in the apache configuration (/etc/httpd/conf.d) because you seem to have a root access
Thanks, I was able to create a /etc/httpd/conf.d/redirect.conf with the following;
<VirtualHost *:80<
ServerName office.mydomain.com
ServerAlias webmail.mydomain.com
Redirect “/” “https://office.mydomain.com/webtop”
</VirtualHost<
<VirtualHost *:80<
ServerName office.mydomain.com
ServerAlias cloud.mydomain.com
Redirect “/” “https://office.mydomain.com/nextcloud”
</VirtualHost<
And that works for the following redirects
mydomain.com → https://office.mydomain.com/webtop
office.mydomain.com → https://office.mydomain.com/webtop
webmail.mydomain.com → https://office.mydomain.com/webtop
cloud.mydomain.com → https://office.mydomain.com/nextcloud
Which is what I want, but how can I do the following https->https redirects?
mydomain.com → https://office.mydomain.com/webtop
office.mydomain.com → https://office.mydomain.com/webtop
webmail.mydomain.com → https://office.mydomain.com/webtop
cloud.mydomain.com → https://office.mydomain.com/nextcloud
If I use the following, httpd fails on restart
<VirtualHost *:443<
ServerName office.mydomain.com
ServerAlias webmail.mydomain.com
Redirect “/” “https://office.mydomain.com/webtop”
</VirtualHost<
something interesting in /var/log/ssl_error ?
/var/log/ssl_error does not exist…
I am not getting SSL errors, the httpd restart fails if I have the <VirtualHost *.443 section in my /etc/httpd/conf.d/redirect.conf file.
Something in the <VirtualHost *.443 section is not right obviously.
I don’t know if I need to point to my certificate or something, but I have a valid certificate, I just want to redirect to the location that does have the certificate, it a https address is entered.
What I want is these redirects;
https->https redirects?
https://mydomain.com → https://office.mydomain.com/webtop
https://office.mydomain.com → https://office.mydomain.com/webtop
https://webmail.mydomain.com → https://office.mydomain.com/webtop
https://cloud.mydomain.com → https://office.mydomain.com/nextcloud
I was on my mobile phone, sorry take a look to :
[root@NS7DEV5 ~]# less /var/log/httpd/ssl_error_log
Well, there are not errors when I try to add the <VirtualHost *.443 section as httpd fails to start.
But, when I remove that section and have just these
<VirtualHost *:80<
ServerName office.mydomain.com
ServerAlias webmail.mydomain.com
Redirect “/” “https://office.mydomain.com/webtop”
</VirtualHost<
<VirtualHost *:80<
ServerName office.mydomain.com
ServerAlias cloud.mydomain.com
Redirect “/” “https://office.mydomain.com/nextcloud”
</VirtualHost<
I get the following error on httpd restart;
[ssl:warn] [pid 6579] AH01909: RSA certificate configured for nsserv-data.mydomain.lan:443 does NOT include an ID which matches the server name
I think this is just because my certificate is for office.mydomain.com
If I remove my redirect.conf file completely, I still get the same error.
If I try to navigate to https://cloud.mydomain.com, it just goes to the NethServer place holder page, and gives the following error, I assume just because I don’t have a page there;
[autoindex:error] [pid 7058] [client 192.168.0.100:56526] AH01276: Cannot serve directory /var/www/html/: No matching DirectoryIndex (index.html,index.php) found, and server-generated directory index forbidden by Options directive