Submitted by lueung on Sun, 09/06/2009 - 01:28
I tried using name alias and create alias server, but it lacks the ability to show contents in a subdirectory. I am trying to create an alias to show a website. Here is an example of what I am trying to accomplish.
create alias: games.friendsforcash.com
which shows the contents of: friendsforcash..com/arcade/
How do I accomplish this?
Status:
Active
Comments
So, what you're describing is a cPanel style sub-domain account type, which we deprecated several years ago (because it confused the heck out of everybody except former cPanel users).
The usual way to provide different content is to create a new virtual server (a sub-server in this case), regardless of whether it happens to be named with a subdomain of an existing website.
So, you can create a sub-server named games.friendsforcash.com, owned by friendsforcash.com, and the administrator of friendsforcash.com will have administrative privileges over games.friendsforcash.com, as well. The content of the site will not be within the public_html of the parent virtual server, however...it will be in /home/friendsforcash/domains/games/public_html.
An alias is exactly what it says it is: an alias of an existing site. It is not intended to serve different content (that's what virtual servers and sub-servers are for).
In other words...you can't do what you're after, without making some pretty dramatic Server Template changes (and maybe writing a few lines of shell, Perl, or whatever code) to make things spin that way.
You could, I guess, link to sub-server directories from the parent virtual server public_html, but I've never heard a good reason for wanting sites to be laid out this way...it leads to duplicate content, which is bad for your Google rank, among other things. It's also potentially problematic from a login session perspective for any apps you run on those sties.
Submitted by lueung on Sun, 09/06/2009 - 09:13 Comment #2
I've never used cpanel. However, this was something I've used often on the Plesk panel. I can't remember exactly how it's done but they gave you a couple of options. The ability to show contents of a subdirectory make it really convenient.
The ability to show contents of a subdirectory make it really convenient.
I don't think I understand the convenience factor here. What is it about having files in one specific directory over another is convenient?
What I'm trying to say is what is inconvenient about making sub-servers for this purpose? We'd like to fix it, if it's something other than "it's not what I'm used to".
Submitted by lueung on Sun, 09/06/2009 - 19:34 Comment #4
There are many reasons.
Virtualmin already have a create server alias, (and if you are worried about duplicate content) whether it show the root directory or not. It's the same thing so why not add the ability to customize which content it shows such as xxx.com/subdir or xx.com/xx/xx/whatever.
Not every one that owns a web site cares about Google or duplicate content.
The main content of a site maybe private only and a server alias is to easily to show only the contents of the subdirectory by just typing xx.com
The same thing can be accomplished by creating a new virtual server and then include a redirect in the virtual server's root to the subdirectory of the alternate site. However, this requires way too many resources and extra added steps. One might as well make a whole new site.
The list can go on and on.
Isn't the idea of why people using virtualmin is because of the power of flexibility? Besides, people have the option of not using it, but it's a useful feature to have when you need it. On top of that, it allows for reuse of the same content without much of a hassle.
Virtualmin already have a create server alias, (and if you are worried about duplicate content) whether it show the root directory or not. It's the same thing so why not add the ability to customize which content it shows such as xxx.com/subdir or xx.com/xx/xx/whatever.
Virtualmin uses the Apache ServerAlias feature for its Alias server type. It can't do what you describe. An alias is actually an alias for an existing site. There is no "Directory" section for a ServerAlias...there is no way to make it do something else, without making it something other than an alias.
Not every one that owns a web site cares about Google or duplicate content.
True. But this isn't a reason why you would want this kind of account (just a solid argument for why that problem shouldn't stand in the way of such an account, if it did have reasons for existing). Just because a bad feature isn't bad for everyone doesn't make it a good feature. ;-)
The main content of a site maybe private only and a server alias is to easily to show only the contents of the subdirectory by just typing xx.com
So...I guess I can see an argument for making a redirect or setting a different DocumentRoot on the sub-server creation form (it can't be on the alias page, because a ServerAlias also has no sections for redirects or proxying--a ServerAlias has not sections at all, just one option...the name of the alias). I tend to veto things that make forms more complex than they need to be, though.
The same thing can be accomplished by creating a new virtual server and then include a redirect in the virtual server's root to the subdirectory of the alternate site. However, this requires way too many resources and extra added steps. One might as well make a whole new site.
On the resources count, the feature you're talking about in Plesk and cPanel does not use the (practically free) ServerAlias feature...it can't, because it can't do what you describe. This type of virtual host on a Plesk or cPanel system would have to be a whole new VirtualHost section...just like a Sub-server on Virtualmin. It just happens to have a weird location for the public_html (that overlaps and is part of the parent server public_html).
The list can go on and on.
But, none of these are reasons for this particular directory layout to be a good thing. ;-)
You can create new sub-domain named sites that are controlled and managed by an existing user by creating a sub-server in Virtualmin. The only difference (aside from being far more flexible) is that the content isn't intermingled inside the public_html of the parent virtual server. I still don't understand what benefit there is to having content for one site located within and overlapping another site.
Finally, if you really believe there are benefits to this kind of directory layout, you can (I think) still enable this feature in Virtualmin. I don't recommend it (because it confuses folks who aren't already looking for and familiar with this kind of functionality; and it convinces them that this is the only way to create a different site with a subdomain name), but if it's necessary for you to be happy with Virtualmin, you can.
Browse to System Settings>Module Config>Advanced Options, and set "Allow creation of sub-domains?" to "Yes".
This enables the additional Sub-domain account type, which is a cPanel-style Sub-domain account type...it puts content into /home/parent/public_html/subdomain, and has no other features or capabilities.
I would advise caution before exposing your users to this feature. We disabled it by default because it confused so many people, and caused them to make bad decisions about their site layout. We also got a lot of support issues regarding the "missing" features of sub-domain accounts, which we can't fix (the solution to "missing" features is to use a sub-server account which can do pretty much everything a virtual server can do, just under the control of an existing website account). But, if you expect things to work this way and won't be happy without it, we don't want to keep you from doing it (actually, I do, but I won't). ;-)
Submitted by lueung on Mon, 09/07/2009 - 00:22 Comment #6
Thanks Joe. As always I appreciate your candid response. I must also say that you guys are doing a hell of a job and I am one happy camper since switch to virtualmin some odd years ago.
In our case this functionality works quite well for our purposes. No features are needed, just point to the directory and show the content that's all. :-)
Submitted by lueung on Mon, 09/07/2009 - 00:59 Comment #7
OK the enable subdomain feature. However, I do not believe it is what I am looking for as it does not offer an entry box to enter the address.
I believe I may not have explained it with sufficient clarity. In Plesk when creating a new domain (let say xy.com) it would ask if you want it to be a physical server account or a forwarding.
If you choose the latter it would then ask you where you'd it like to redirect it which I can then enter zz.com or abc.com/whatever or ff.com/subdir/whatever.php or ggg.com/index.php?whatever
There is also a selection to simply forward it to the new page and the address bar would show the new address that it is forwarded to. For example xx.com -> xzy.com/stuff.html and the address bar shows xzy.com/stuff.html
The other option is forwarding and show the new content but the address bar shows the same initial address. For example: "tt.com" -> "hey.com/stuff.html" but the address bar still shows "tt.com"
Hopefully you can understand what I am saying. LOL.