Bhaskar Rajoriya Bhaskar Rajoriya - 25 days ago 10
Apache Configuration Question

How to config multi projects with single domain?

I am too new in server technology. I have some problem with configuration of multi projects with each different framework in single domain.

The scenario is, i have a folder structure like below

/web
/project-angular
/dist/index.html

/project-aurelia
/index.html

/project-wordpress
/index.php


I need to setup these projects with single domain with conditions are :

1 if user access domain.com then need to run project-angular/dist/index.html

2 if user access domain.com/blog/(*) then need to run project-wordpress/index.php

3 if user access domain.com/(*) then need to run project-aurelia/index.html


I am trying this experiment on my local so i have access of each files.

Please suggest how i can achieve this. I have tried with .htaccess but it is like foreign language for me.

Edit :

I don't want to redirect users to another domain. I just want that if access the domain.com then according to above description folder code should run.

Thanks.

Answer Source

I found a solution for this problem. And now sharing with you all which I did. Please check and let me know if you have any Queries. Create Alias.

1 Set domain.com with Aurelia project directory. Because apart from / and /blog we need all other URL from Aurelia. (Solution of Point 3)

2 Create an Alias for Blog section as /blog. And set the domain.com/blog/(*) with WordPress project directory. (Solution of Point 2).

3 For URL / create the other Alias for example /home and set the domain.com/home with Angular project directory. And keep the Angular project in Aurelia Root directory.

Redirect the user to Angular base URL whenever user will access domain.com

Add below code in the httpd-vhosts.conf file.

<Directory "path-to-aurelia/project-aurelia/">
    DirectoryIndex project-angular/dist/index.html
    Options Indexes FollowSymLinks MultiViews
    AllowOverride all
    Require all granted
</Directory>

Now All the Angular links will run on domain.com/home/(*). (Solution of Point 1)