Jump To: Support > KB > NetManager > Webserver > redirecthttps
Redirect all requests to HTTPS
Assuming you have enabled HTTPS on your webserver, you can easily set up the server to redirect all HTTP requests to HTTPS. To do this, create a .htaccess file in the root of your webspace (i.e. ~www/.htaccess
or \\netmanager\webpages\.htaccess
) containing the following:
RewriteCond %{HTTPS} !=on
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]
This will redirect to the same web-address as you entered which may not match your SSL certificate, e.g. http://netmanager/ would redirect to https://netmanager/. If you want to redirect to a specific hostname, use this instead of %{SERVER_NAME}
in your .htaccess file, e.g.
RewriteCond %{HTTPS} !=on
RewriteRule ^/?(.*) https://intranet.mydomain.com/$1 [R,L]
If you want to only redirect to HTTPS when using a specific name (i.e. you don't want to redirect internal access, but do want to redirect external access), use something like this (N.B. this would still allow HTTP access if using http://external.ip.address.here/):
RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP_HOST} "^intranet\.mydomain\.com$" [NC]
RewriteRule ^/?(.*) https://%{HTTP_HOST}/$1 [R,L]
If you want to redirect to HTTPS when NOT using a specific name (i.e. you don't want to redirect internal access as http://netmanager/, but do want to redirect external access), use something like this:
RewriteCond %{HTTP_HOST} "!^netmanager$" [NC]
RewriteRule ^/?(.*) https://intranet.mydomain.com/$1 [R,L]