I have a one project being hosted in Apache under a specific subdomain:
<VirtualHost *:80>
ServerName dev.example.com
DocumentRoot /web/vhosts/dev.example.com
<Directory />
Allow from all
</Directory>
</VirtualHost>
I want to serve another project under a subdirectory of this domain:
dev.example.com/special-project
Which lives in /web/vhosts/special-project
. I also can't simply create a symlink to this directory because of the way the original project is structured. It has to be configured using Apache only.
How do I configure Apache to be able to do this? Also, can this type of configuration be specified in a separate file, or does it have to be part of the original VirtualHost
definition?
This config will show a basic example on how to server a content out of directory other that the DocumentRoot directory using Apache2 web server. Let's begin with a simple virtual host configuration. The given html document has been loaded from the DocumentRoot directory /var/www/html .
The document root is a directory (a folder) that is stored on your host's servers and that is designated for holding web pages.
Use an Alias.
Alias /special-project/ /web/vhosts/special-project/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With