Jump to content

Recommended Posts

Hi all, I am trying to configure a website on an Apache2 server, and having some difficulties achieving the desired outcome.  I'm actually not even sure what I am trying to do can be done or not. 

 

I have two separate web applications, we'll call App-A and App-B.  The source files for these two applications sit on the same server.  The applications were coded so that they run independent of eachother.  In my situation, this means that the file structure setup for each is independent, and each has been built to run with different directories as its "webroot" directory.

 

I am trying to call / run App-B from App-A.  There is a domain registered with App-A:  http://app-a.mydomain.com, but there is no domain registered for App-B.  I would like to be able to have the URL http://app-a.mydomain.com/app-b point to and load the App-B application.  The problem I have is in my VirtualHost file, the DocumentRoot parameter has been set to /var/www/sites/app-a and when App-B is loaded, that needs to change to /var/www/sites/app-b.  Is there any way in the VirtualHost file to change the document root when someone types http://app-a.mydomain.com/app-b ?  or any way to have that URL point to and load a different VirtualHost file on my Apache2?

 

Thanks in advance!

Link to comment
https://forums.phpfreaks.com/topic/142654-solved-changing-documentroot-at-runtime/
Share on other sites

I'm not sure how your solution would work... If I just created a fake domain name, then this wouldn't be servable to the rest of the world.  I need someone to point their browser to http://app-a.mydomain.com/app-b , and have Apache load the app-b VirtualHost file rather than the one for App-A.  The "ServerName" directive in the App-A VirtualHost file is set as:

ServerName app-a.mydomain.com

 

Are you able to provide a quick example?  Thx.

What operating system is it?  If it's one that supports symbolic links, just make a symbolic link.  Or use an Alias statement in Apache.  Either one would have the same effect.

 

 

In the configuration for host A:

 

Alias /app-b /path/to/app-b/folder

 

 

Or, if you want to go the sym link route:

 

mklink /D /path/to/app-a/app-b/ /path/to/app-b/folder/

 

 

(That's the Windows format.  Not sure about linux.)

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.