I need to add Alias to a servers main web directive and I don't want to do it through the main config file. I am wondering if there is a way to include text from another file into a directive, for example
<VirtualHost *:80>
DocumentRoot /var/www
ServerName *.website.co
Alias "/old_directory" "/var/www/old_content/old_directory/"
</VirtualHost>
So the users are served an alias if the URL matches the old_directory. The above works fine, however I would like to make this dynamic and not move the main rule to a separate conf file. So something like this:
<VirtualHost *:80>
DocumentRoot /var/www
ServerName *.website.co
* include a file /var/www/alias/alias.txt
</VirtualHost>
In the alias.txt file I would have a list of aliases
Alias "/old_directory" "/var/www/old_content/old_directory/"
Alias "/old_directory1" "/var/www/old_content/old_directory/1"
Alias "/old_directory2" "/var/www/old_content/old_directory/2"
Alias "/old_directory3" "/var/www/old_content/old_directory/3"
etc.
In this case I don't want to move the main virtualhost directive out of the main conf file and when trying to duplicate the rule in another file using the Include option, it ignores that one because it was already declared I guess.
Is there anyway to include like that or is there a better way to handle this?