Need help adding domain

Ok, I’m not sure if this is even possible, but I will try to explain.

Have a domain setup in virtualmin at http://xxx123.com.
It has username xxx123 and www directory is set to /home/xxx123/public_html.

Over the last few months I have developed an android app which has been integrated into a custom wordpress cms site which has been (at the time, for convenience sake) placed in /home/xxx123/public_html/myapp/wp. And this site access files in several directories in /home/xxx123/public_html/ and /home/xxx123/public_html/myapp.

Now I’ve come to the point where I’ve registered www.myapp.com and I would like to point this domain to my already setup wordpress cms site which is located in the mentioned directories. How would I do that? I need www.myapp.com to land in /home/xxx123/public_html/myapp/wp and still let website have access to the directories /home/xxx123/public_html/
and /home/xxx123/public_html/myapp.

I hope someone understands what I’m trying to do.
All help is much appreciated! (Free beer to to anyone who helps me solve it :))
.

Hi xuw

Could you tell us if the app that will live at myapp.com is owned by the same user as xxx123.com? I’d guess it is considering it used to live in a subfolder of that domain.

Assuming I’m right, then I would set up a sub-server of xxx123.com with the new myapp.com domain, which will create a directory at /home/xxx123/domains/myapp.com with a public_html sub directory.

Here you have 2 choices:

  1. create a symlink from /home/xxx123/domains/myapp.com/public_html to /home/xxx123/public_html/myapp/wp
  2. modify the apache config to point the domain(s) myapp.com (and wwww.myapp.com) to the /home/xxx123/public_html/myapp/wp directory

If you choose the second option, I don’t believe that virtualmin or webmin has an option to handle this for you as the directive is intended to be configured by virtualmin. Unless someone else corrects me, you’ll need to make this change manually by opening /etc/apache2/site-available/myapp.com.conf (if on debian based systems) and replacing all filepaths to the default location with the sub directory at /home/xxx123/public_html/myapp/wp

Alternatively, if it’s no longer needed at the existing location, simply copy and paste (or move) the files across to the new location. The existing DB user from the parent account will still have access to the database so it should only be a matter of adjusting the domain in WordPress’ config files / DB (I don’t use WP so you’ll have to get that info from elsewhere, sorry).

Hope this helps.

There’s an option to configure the document root for existing domains in Virtualmin, enabling you to point it to subfolders of your public_html from within Virtualmin. I think it should be in “services / configure website”. Can check this later when I’m at my PC.

There’s an option in Virtualmin > Server Configuration > Website Options, however that only allows you to use sub directories of that particular website’s subdirectory. As the OP wants to use the sub directory of the parent’s public_html I don’t think Locutus’ suggestion would work.

I don’t know how it performs, but you could try using the options in Virtualmin > Server Configuration > Website Redirects - there’s an option to set the destination to a Directory on this system so simply enter your /home/xxx123/public_html/myapp/wp directory in there, / in Source Path, and choose Include sub-paths then see what happens.

Let us know how you get on.

The OP didn’t really mention that he wants to create a sub-server, because those get home directories in /home/PARENT/domains/SUBSERVER by default, so that’d be completely separate from the the parent’s public_html.

I guess the best way to solve this present issue would be creating an alias of the main server, and do some manual configuration with redirects to serve it from the required directory. It’s a slightly unusual construct in terms of how Virtualmin sets up its stuff.

Hi,

It might be possible for you to add an Apache virtualserver (Servers > Apache) with the following details:
Port: 80
Address: Any
Name: myapp.com
Document root: /home/xxx123/public_html

Then with some configuration from either .htaccess files or redirects, you could put the user straight into /myapp or /myapp/wp, and then let them go into other folders when they navigate to them.

Otherwise, I think you might need to rethink how you’re doing this - I can’t really see how that layout would work? Perhaps you need to move everything into one folder, so that it’s all accessible from one single folder?