r3gan23 Posted January 27, 2009 Share Posted January 27, 2009 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! Quote Link to comment Share on other sites More sharing options...
corbin Posted January 27, 2009 Share Posted January 27, 2009 You could just use your hosts file and make a fake domain name for app b. Or, you could use a symbolic link to have app-b point to the app-b folder. Quote Link to comment Share on other sites More sharing options...
r3gan23 Posted January 27, 2009 Author Share Posted January 27, 2009 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. Quote Link to comment Share on other sites More sharing options...
r3gan23 Posted January 27, 2009 Author Share Posted January 27, 2009 I'm marking this as solved as I don't think there is a way to achieve what I was trying to do by using Apache configurations, so I will try other alternatives. Quote Link to comment Share on other sites More sharing options...
corbin Posted January 28, 2009 Share Posted January 28, 2009 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.) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.