Reputation: 5909
I want to link a directory from my document root to a directory which is not under document root. Example structure (document root is www) my_web/www/ my_web/www/images/custom/ <- there I want to place .htaccess my_web/var/ my_web/var/uploads/images/ <- there it should point
So, for example when I access http://my.example.com/images/custom/foo.jpg, the server should respond with my_web/var/uploads/images/foo.jpg if it exists (of course it cannot be a 301 redirect).
Is this possible just through .htaccess? I know how to use mod_rewrite, but it seems that it cannot redirect to anything outside the document root folder.
I have only FTP access to the server, so I cannot set any file system symbolic links there. The only solution I see now is to create a simple PHP file under the images/custom folder, point .htaccess to it and retrieve the requested file from /var with it, but pure .htaccess solution would be more simple and elegant.
Thanks in advance
Upvotes: 0
Views: 163
Reputation: 17871
In htaccess (directory context), it's only possible to rewrite from a URL to a URL, not to a filesystem path. If that filesystem space is not reachable by an existing alias, and permitted to be served with a Directory block, you won't have any success.
Upvotes: 1