Question about migrating certain older cPanel sites that use subdomains

Apparently, cPanel used to create new subdomains pointing to subdirectories of /public_html/ on the parent domain, for example:

/home/parent/public_html/sub

I've seen this on enough older sites that I have to assume it was an old cPanel convention that even they realized was stupid. The current method is to point them to

/home/parent/sub.parent.tld

As far as I can tell, the Virtualmin migration tool checks for the more recent subdomains and imports them as subservers in

/home/parent/domains/sub.parent.tld.

When the subdomains were created using the older cPanel method, however, subservers are created pointing to

/home/parent/domains/sub.parent.tld

but the files that were inside the subdirectories are not imported. (They're still there in the subdirectories in /public_html/, but they're not placed inside the new subserver directories.)

This is an old cPanel quirk, not a Webmin or Virtualmin bug. But in terms of making the subservers work properly once migrated, two possible solutions come to mind:

  1. Create new directories using the newer method before the site is migrated, populate them with the files, and re-point the subdomains.

  2. Re-point the subservers to the old directories post-migration. I think this could be done in Edit Website Redirect by pointing sub.parent.tld to /home/parent/public_html/sub/$1, but I haven't actually tried it on a test server.

Obviously, method 1 would be better. Method 2, however, (assuming it would work) would be easier for clients who are not professionals (for example, small businesses who paid someone to have a site built, but currently maintain it themselves).

My question is: Other than being unconventional and perpetuating something that was done stupidly to begin with, is there any functional problem with using Method 2? Would Virtualmin vomit on it in some way (stats, etc.)?

Thanks!

Status: 
Active

Comments

This would help me a lot - if I could get it to work. I am a total newbie to Virtualmin so please excuse the naive question.

To explain what I think is supposed to happen: I had C-Panel "sub-domains" eg: genealogy.metastudies.net but it appears as a folder in public_html as genealogy. But Virtualmin expects genealogy.metastudies.net and creates a folder in /rootname/domains/genealogy.metastudies.net. But it doesn't have my files which remain in a folder in public_html/genealogy

I have tried to follow your suggestion by creating a web redirect with the following inserts (but I think I misunderstand what is needed). This is my entry: Source URL path /genealogy.metastudies.net Destination . Directory on this system /home/rootname/public_html/genealogy/$1 HTTP redirect type Default Include sub-paths in redirect .Yes

I am pretty sure this is wrong, but not sure what would be right. Can you clarify please for this real world example?

Many thanks!

Ilia's picture
Submitted by Ilia on Thu, 02/20/2020 - 04:46

Assigned: Unassigned ยป

Hi,

Thank you for heads up!

Other than being unconventional and perpetuating something that was done stupidly to begin with, is there any functional problem with using Method 2? Would Virtualmin vomit on it in some way (stats, etc.)?

I personally wouldn't do it. You not only may face permission and possibly security issues but it also creates a mess, that is harder to support. Unless you really need it to be a simple sub-server, I would create a separate virtual server for all sub-domains, which would have a separate home directory, separate users for database, ftp and etc.

Speaking about how it should be done upon migration, I will pass this to Jamie for review, maybe he would spot something worth improving.

Thanks - I know option 2 is not lovely, but if I could get it to work it would definitely get me out of a hole now, and later maybe I could do something more elegant when I understand more....... So any assistance on this migration issue would be a great help.

The alternative might well be to make some clever changes in the original c-panel and re-migrate, but that is also not clear to me as to what or how to do it. In particular if I start messing around with the names of folders in public_html in my cpanel server, I will end up with un-ending broken links in what are huge websites developed over some 20 years. So... what seems an ugly work-around may in fact be far preferable, especially at a time of pressure for me. Most of it works really well - it is just this niggly but crucial problem, notably for one "sub domain".

RJM Web Design's picture
Submitted by RJM Web Design on Thu, 02/20/2020 - 06:01 Pro Licensee

I wound up creating directories on the cPanel server per the current convention before migration, pre-populating them with the files, and re-pointing the subdomains in cPanel pre-migration. That put them where the Virtualmin migration routine expected them to be. That seemed to work.

This was only necessary for very old subdomains, by the way. Recently-created ones are already in the paths that Virtualmin expects.

Richard