Glam Prestige Journal

Bright entertainment trends with youth appeal.

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.

1

1 Answer

Is it possible to have multiple DocumentRoot directives 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:

  • and would map to /www/site_new

  • and would 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, /en would need to be a symlink to /www/site_new.

  • In /www/site_new, /about-us would 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.


Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy