I have virtualmin up and running and I’m really pleased with how easy it is to use. I have a bit of an odd requirement.
I have a domain, domain. com, and I’d like to present different sites on www.domain. com and domain.com. The www will go to a wordpress site and the “root” will go to a link shortner admin page.
When I created the virtualserver in virtualmin it automatically created the www. I tried changing the server template, but it still won’t let me create a www.domain. com site.
Is there any way to have two different sites one running on www.domain. com and one on domain. com?
OK, so if you removed the automatic ServerAlias www.${DOM} from the Server Template, and removed the www automatic DNS record, I’m surprised you can’t create a new server or sub-server for www.
You said it won’t let you…but what does it do? Is there an error?
Ah, Virtualmin is maybe being too smart for its own good here.
@Jamie is there an easy way to convince Virtualmin not to prevent creation of both a www.domain.tld and a domain.tld (with different contents)? Assuming, of course, that Server Templates have been modified to remove the automatic www alias.
This is not a good idea having completely different websites running on example.com and www.example.com.
@michaelsage Although, I can see that Jamie made a change that will allow root user to use virtualmin create-domain Virtualmin CLI with --skip-warnings flag to get initially desired result.
@Jamie, are you sure that removing other (i.e. not only /^(www)\./i) checks in valid_domain_name sub is a good idea?
Just out of curiosity why do you think this? This is a bit of an odd site in that the website for the site is different to the requirement for the “root”. The full website sits on www and a url shortner sits on the “root”. They don’t play nice if you put them on the same site, competing requirements, I tried putting the website in a directory /website and it just didn’t work very well. So this seemed like the best solution, but I’d love to hear what you think
The domain.name has a homepage redirect to www. The URL shortener application just didn’t play nice sitting on the same site wordpress, I was getting all sorts of redirect issues from both platforms. So for my use case I think splitting them is the easiest solution.
That way normal users will get your home page whether they got to www.domain.com or just domain.com and you cam do whatever you need by going to wpadmin.domain.com and nobody else needs to know about it.