Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reaching files outside od the documentroot scope

I'm writing a script to build a dynamic website, the website is created by loading external components.

The DocumentRoot is location at /sites/website/public the components directory is located at /sites/website/components

i wannna reach the data directory of each component depends on the requested url.

for example:

the url:

http://ibuildmywebsite/component-data/randomimage/demo/swan04090044_small.jpg

should fetch the file /sites/website/components/randomimage/data/demo/swan04090044_small.jpg

how can i achieve that ? i would prefer a way that can be placed inside .htaccess (if there is one) instead of modifying the virtual host definitions.

Thanks!

like image 250
ufk Avatar asked Jun 27 '26 01:06

ufk


1 Answers

Combine RewriteRule with Alias maybe ?

Alias /randomimage /sites/website/components/randomimage
RewriteRule ^component-(.*)/randomimage/(.*)$ /randomimage/$1/$2 [R,L]

(Won't work in .htaccess though)

You could probably also use Symlinks with:

Options +FollowSymLinks

And link dynamically components-*/randommimage/* to /sites/website/components/randomimage/*/*/

like image 118
Oct Avatar answered Jun 30 '26 06:06

Oct



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!