These forums are locked and archived, but all topics have been migrated to the new forum. You can search for this topic on the new forum: Search for Non-www to www redirect using Nginx on the new forum.
I've been trying to figure out how to setup a non-www to www domain redirect on a virtual host within Virtualmin with no luck.
The only way I've been able to get this to work is by manually editing the nginx config for the virtual host and using the following:
if ($host = 'tribaltracks.co.uk') {
rewrite ^/(.*)$ http://www.tribaltracks.co.uk/$1 permanent;
}
Does anyone know how this can be achieved within Virtualmin or if there is a better way of doing this?
Many thanks.