Website Redirects feature never creates permanent redirects when using Nginx


We are using Nginx and need to redirect requests from one domain to another. Both domains are virtual servers configured properly in Virtualmin.

On the source domain (the one I want to redirect requests from), I've set up a redirect using the Server Configuration > Website Redirects feature. I set the source URL to "/", the destination URL to$1, the redirect type to permanent (301), and have chosen to include subpaths in the redirect. Saving my changes produces no errors.

However, when I go in and edit the redirect to verify everything, the redirect type is set back to default. If I set it to permanent, save my changes, and then go back and edit the redirect again, it is back to being set at default.

Looking at the raw virtual host configuration file, this is what it shows:

rewrite ^/(?!.well-known)(.*) break;

When, according to the Nginx documentation, permanent redirects should look like this:

rewrite ^/(?!.well-known)(.*) permanent;

Making this change manually in the virtual server configuration file and then restarting Nginx results in the correct 301 redirect.

Upon further investigation, it appears the rewrite rule doesn't actually include subpaths as I specified in the Virtualmin redirect configuration. A permanent redirect line that causes subpaths to work properly should look like this:

rewrite ^/(?!.well-known)(.*)$$1 permanent;

Fixed (pending)
Virtualmin version: 
Webmin version: 


Fixed (pending)

Thanks for pointing this out - we'll add support for different redirect codes in the next release of the Nginx plugin.