Nginx Redirect Recommended Way (nginx_vhost.conf.master)

Discussion in 'Installation/Configuration' started by OptimBro, Apr 19, 2020.

  1. OptimBro

    OptimBro Member

    Hi Team

    Can we create redirection like the official method: Like this for http to https version?

    This is the recommended method.

    server {
    return 301 $scheme://$request_uri;
    server {

    Is it possible to do something like this by modifying nginx_vhost.conf.master?

    <tmpl_if name='seo_redirect_enabled'>
            if ($http_host <tmpl_var name='seo_redirect_operator'> "<tmpl_var name='seo_redirect_origin_domain'>") {
                rewrite ^ $scheme://<tmpl_var name='seo_redirect_target_domain'>$request_uri? permanent;
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    Yes, that should be possible. Remove the current part and add your code snippet outside of the server {} block. But I guess you will not notice any measurable difference unless you have millions of daily visitors in that site.

Share This Page