Question

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!

Was it helpful?

Solution

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/*/*/

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top