Description:
I often run into this problem when I have a website located in /var/www/
that grows way too large, and decide to move, essentially all of it, to /var/www/main_files
. Simply putting a symbolic link /var/www/index.html
pointing to /var/www/main_files/index.html
does not work. I believe the reason it does not work is because the index.html
file is still be "executed" in the directory of the symbolic link (/var/www
). Therefore, any files which need to be included/fetched, will no longer have the correct paths.
One could change the VHost directory to /var/www/main_files
, but that is too permanent. I may still want to have a few files in /var/www
. I could also go through and manually change any file paths in the actual html/php/js files, but that is not only too permanent, it is painstakingly slow.
Question:
Is there a way, short of using mod_rewrite (which, again, is too permanent), to instruct Apache to follow symbolic links (assume symlinks are all within docroot) and, when the user goes to www.example.com/index.html, load the web page as if the user had gone to www.example.com/main_files/index.html? If not, then what other options should I consider?
Motivation:
I most often run into this problem when I want to debug a site, and I quickly download a free template (ie download this one). Most of these templates have all their files in the top folder, making it very messy to dump it all to /var/www
, especially with more than one template. What I want is to make a subfolder for the template, but still be able to load it from www.example.com/index.html, not explicitly from www.example.com/template1/index.html