301 redirect from subfolder

Discussion in 'ISPConfig 3 Priority Support' started by kaostc, Feb 3, 2025.

  1. kaostc

    kaostc Member HowtoForge Supporter

    It is possible to make a 301 redirect from mydomain.com/subfolder to another URL from ISPConfig? Is there such option, or have to be performed by inserting nginx directives in the last tab of the site? (I am using nginx).
    Thanks.
     
  2. remkoh

    remkoh Active Member HowtoForge Supporter

    Using a nginx directive is one way to go with that.
    Code:
    location /subfolder {
        return 301 "<url to redirect to>";
    }
    
    Or if you want to redirect only when the requested folder (and file) can't be found use
    Code:
    location /subfolder {
        try_files $uri $uri/ @redirect;
    }
    
    location @redirect {
        return 301 "<url to redirect to>";
    }
    
     

Share This Page