set diffrent virtualhost DocumentRoot for specific urls under the same domain

79 Views Asked by At

I have a project under domain like example.com and i defined a virtualhost for it and it's working fine, i just want to server example.com/about from fully different DocumentRoot

I tried to configure ProxyPass but it's only serve the request but all page assets files (css,js ,etc ) are served from the other DocumentRoot.

I tried also rewrite rule but it's giving 403!

Example of the two projects path

Project1 /var/www/project1 Project2 /var/www/project2

How i want it to work

http://example.com/ => server the url and all it's assets from /var/www/project1

http://example.com/any-page => server the url and all it's assets from /var/www/project1

http://example.com/about => server the url and all it's assets from /var/www/project2

1

There are 1 best solutions below

0
arco444 On

You need to use an Alias in your .htaccess or virtual host config file.

DocumentRoot /var/www/project1
Alias /any-page /var/www/project1
Alias /about /var/www/project2

You will not need the alias for /any-page if project1 already has a directory with that name. If it doesn't then going to /any-page will be identical to going to /