create subdomain withoutout VM Pro license?

5 posts / 0 new
Last post
#1 Thu, 11/29/2018 - 17:22
midol

create subdomain withoutout VM Pro license?

I'm using a subdomain in which I've put content using VM Pro facilities. This used up one of the current 50 licenses. The subdomain will no longer be used, so I am thinking I'll delete it. I think this will end the license instance is that correct? Then I want to recreate the subdomain and just put in a redirect; if I do will that use up a license instance?

Fri, 11/30/2018 - 09:48
andreychek

Howdy,

WIth Virtualmin Pro, a Virtual Server, Sub-Server, or Sub-Domain all count towards the license.

However, alias servers do not.

If you delete one of the above, and re-add it as an alias, it will no longer count towards your license.

-Eric

Fri, 11/30/2018 - 18:56 (Reply to #2)
midol

another point I'm curious about is whether the alias domain can point incoming traffic for specialpurpose.mydomain.com to mydomain.com/specialpurpose? that work?

D

Fri, 11/30/2018 - 22:51 (Reply to #3)
Joe
Joe's picture

You can do it with mod_rewrite (enabled by default in a Virtualmin installation), though normally a VirtualHost is the right/simple way to do it (which you could manually add to your config, as well, but it would be outside of Virtualmin's awareness).

Something like the following (which could be in .htaccess or in the httpd.conf):

RewriteEngine on
RewriteCond %{HTTP_HOST} ^(.+)\.mydomain\.tld$
RewriteRule ^/(.*)$ /home/mydomain/public_html/%1/$1 [L]

This is kinda clunky, but if you really need to cut down on domain consumption and don't mind the content intermingling (everything you setup this way will also be accessible on mydomain.tld/specialpurpose, unless you jump through a bunch of other hoops, which may or may not be a problem).

It's probably even possible to add something to the ServerTemplates to automatically make this sort of config work on every new domain you create in Virtualmin (the above uses regexes, so any alias you add to mydomain.tld will automatically try to find the content in /home/mydomain/public_html/subdomain). I'm a little ambivalent about recommending it, as I've always found this kind of subdomain weird and unintuitive (I know our biggest competitor has a "subdomain" feature that does exactly this, and I know a lot of people like it, but I think it's a bad practice and a bad abstraction).

Oh, and the docs for that can be found here: https://httpd.apache.org/docs/2.4/mod/mod_rewrite.html

RewriteRule/RewriteCond can be tricky. I may have messed up the above, even, as I don't do this kind of thing often, and haven't tested. But, it looks mostly right, to me.

--

Check out the forum guidelines!

Fri, 11/30/2018 - 10:45
midol

excellent, that's what I was hoping.

d

Topic locked