Is there a way to mimic symlink behavior with an apache configuration?
Is there a way to mimic symli开发者_如何学JAVAnk behavior with an apache configuration?
For example, from /var/www/someFolder/
I need to reference files in /var/www/anotherFolder/
but do it without using relative paths (because I'm using subdomains) or absolute paths.
Note: Symlinks work but they don't deploy well from git and from my demo site. I would think an apache configuration is much more deployable then dozens of symlinks
Is there a way? With htaccess? With ServerAlias? etc...
If I understood your question correctly then following code in your .htaccess should work fine:
Options +FollowSymlinks -MultiViews
RewriteEngine on
RewriteRule ^someFolder/(.*)$ anotherFolder/$1 [L,NC]
This way a URI of http://domain.com/somefolder
will be internally referencing files from /anotherFolder/
folder thus giving you an effect of symlink without creating an actual symlink.
精彩评论