Automatic subdomains

Hello,
Ive searched forum and Google but without any luck.

Im trying to make 3rd level subdomain to be working by creating a directgory directory.

Idea:

home: /htdocs/

server.com - /htdocs/www
www.server.com - /htdocs/www
abc.server.com - /htdocs/abc
xyz.server.com - /htdocs/xyz

Im thinking about VirtualDocumentRoot or mod_rewrite

like:

server.com to www.server.com

RewriteRule !^/www - [C]
RewriteCond %{HTTP_HOST} ^(www.)?server.com
RewriteRule ^/(.*) /www/$1 [L]

all xyz.server.com to dir /xyz

#RewriteCond %{HTTP_HOST} !^www.* [NC]
RewriteCond %{HTTP_HOST} ^([^.]+).server.com
RewriteCond /somewhere/server.com/htdocs/%1 -d
RewriteRule ^(.*) /%1/$1 [L]


I had no luck with
System Settings -> Server Templates -> Default Template -> Virtual Server Creatio
http://www.virtualmin.com/documentation/web/faq

Any idea how to do this within Virtualmin automaticly (and avoiding mod_rewrite e.g.?) Thanks you

Hi,

I don’t fully follow what your asking but I think all you need to do is create a sub server. The structure is slightly different though:

/home/server/public_html - server.com (and www if you have that configured in the template)
/home/server/domains/abc.server.com/public_html - abc.server.com
/home/server/domains/xyz.server.com/public_html - xyz.server.com

Hope this is helpful,
Dustin

Hi,
thats not exactly what Im looking for. Ok, here is example with full URL:

/home/server/domains/server.com/public_html/www - server.com (and www.server.com)
/home/server/domains/server.com/public_html/admin - admin.server.com
/home/server/domains/server.com/public_html/demo - dmeo.server.com
/home/server/domains/server.com/public_html/test - test.server.com
/home/server/domains/server.com/public_html/xyz - xyz.server.com

aka any directory at /home/server/domains/server.com/public_html/ will create 3rd domain for .server.com.

Hi, okay I see what you want. I’m not sure if that is possible though. Perhaps Andrew, Joe or Jamie will be able to provide that insight. Do you have a professional license for Virtualmin? If so I would open a support ticket.

I’ll let you know if I discover anything that may be helpful.

Howdy,

Sorry, there unfortunately isn’t a built-in way to do that.

The best way I can think of would be to create a catch-all sub-domain, and setup a .htaccess file in it that redirects something like path.maindomain.tld to maindomain.tld/path/.

That would give you something similar I believe… would that perhaps do what you’re after?

-Eric