php - Is it possible for Apache to mod_rewrite a file to its absolute path? -


question

is possible re-write symlinked document root resolved absolute path?

in other words, let's assume have following directory structure:

/www/current -> /www/tags/a /www/tags/a /www/tags/b 

so /www/current symlink points /www/tags/a.

if /www/current document root, possible re-write file path /www/tags/a, file being served no longer following symlink, serving file @ full absolute path? note not asking followsymlinks. want re-write served file full absolute path.


background info

so may asking, why care this?

well, there appears issue symlinked paths when serving php content. if use symlink part of deploy process, , flip @ exact wrong time, appears apache read previous file, , yet php instantiate magic constants such __file__ resolved new directory.

so in previous example, race condition play out follows:

1) apache receives request /www/current/myfile.php 2) apache/mod_php reads file /www/tags/a/myfile.php 3) symlink gets flipped /www/current -> /www/tags/b 4) php interprets , executes code. looks file directory , resolves __file__ /www/tags/b, wrong file.

this leads sorts of havoc, because new code start including files previous deploys.

i'm aware folks @ etsy have written module seems designed solve problem, i'm wondering if same can accomplished through existing apache modules.


Comments

Popular posts from this blog

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -

php - Magento - Deleted Base url key -

android - How to disable Button if EditText is empty ? -