Is it possible to have multiple document roots for the same domain name but with a different language flag?
Example:
and e.g., etc. goes to/www/site_new.and, etc. goes to/www/site_old.
Someone mentioned symlinks, but I can't figure out how to achieve this using the above scenario.
11 Answer
Is it possible to have multiple
DocumentRootdirectives for the same domain name but with a different language flag?
As far as I am aware, the strict answer to this is "no" (that is, you can't have multiple DocumentRoot directives for a given domain name). However, you can create subdomains as virtual hosts and give them their own DocumentRoot:
<VirtualHost *:80> ServerName example.com ServerAlias en.example.com DocumentRoot "/www/site_new" </VirtualHost> <VirtualHost *:80> ServerName de.example.com #ServerAlias DocumentRoot "/www/site_old" </VirtualHost> Mapping URLs To Folders With Alias
Using the Apache Alias directive could provide a solution to your example:
Alias "/en" "/www/site_new" Alias "/en/about-us" "/www/site_new" Alias "/de" "/www/site_old" Alias "/de/uber-uns" "/www/site_old" In this instance:
andwould map to/www/site_newandwould map to/www/site_old.
Someone mentioned symlinks, but I can't figure out how to achieve this with the scenario outlined above.
You can use symlinks as the targets for Alias 1.
Otherwise, using only symlinks, I think you would run into confusion with subfolders. For example (if I am not mistaken):
In your
DocumentRoot,/enwould need to be a symlink to/www/site_new.In
/www/site_new,/about-uswould also need to be a symlink to/www/site_new.
1 With Apache on Windows, this can overcome permissions issues with folders located outside the DocumentRoot given in httpd.conf.