0

I'm currently working on a new project related to another one, the old one. This old project let user uploads avatar, resulting on non-versionned files in /images/avatars.

But in the new project, I need these avatars files too. So I took the avatar directory and put it outside of projects and I use apache alias to serve files :

...
Alias "/images/avatars" "<path/to/shared>/images/avatars"
...

Just working fine.

But, the problem comes with the file /images/avatars/default.png which is actually the only one file to be versionned. And time to time the old-project team has to update it. So they commit it and push it on git, but when we asks git to pull it, that does what everyone expects from it : uploads the file in the original directory (images/avatars/) instead of the aliased directory. And so goes on, when we display default.png on web page, apache follows the alias and displays the copied version (so the old one).

Not sure how to fix that. What I would love to do is to say "Hey, Apache, lets follow this alias for all the avatars with just a litle tiny exception for default.png, would you ?". But life isn't that easy, is it ?

1 Answer 1

0

And I finally found a solution. Instead of using "Alias" I should use "AliasMatch" like that :

...
AliasMatch "^/images/avatars((?!/default\.png).*)" "<path/to/shared>/images/avatars$1"
...

This part ((?!/default\.png).*) is doing the magic. That captures all except if that match default.png.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .