Can you really browse the data within the php $_SESSION array within the .htaccess file in Apache? So say I've the next:

$_SESSION['foo'] = 'bar';

could Then i inshtaccess make a move like:

RewriteRule bla.png folder/{the php session var foo}/file.png

Is the fact that possible?

I curently have a functional workaround but when you could do it might be way better.

I am unaware that it is possible.

However I can think about a couple of workarounds including spinning to some PHP script.

I am unsure if the will affect your unique problem or otherwise but RewriteMap is an extremely helpful and frequently over-looked directive for mod_rewrite.

http://httpd.apache.org/paperwork/2./mod/mod_rewrite.html#rewritemap

If you're able to pre-compute your session variables or store these to a text file (maybe once they get set) the map records can be simply retrieved according to the available request particulars.

Otherwise, you can come up with an easy exterior mapper (most likely, a PHP script as that'd be simplest) that utilizes the sessionid to look for the worth of the session variable and returns the correct URL for that rewrite rule to make use of.

I do not think this really is something you could do easily. You can browse the PHPSESSID using something similar to % inside your .htaccess, but to be able to obtain access to the particular data within the session PHP does procuring work, so you would need to in some way re-implement that (i.e. reading through the information no matter where it's saved, p-serializing etc.)

You cannot do this how you want.

If you're really while using $_SESSION variable maybe there's an Apache environment variable which you can use which will have a similar value because the $_SESSION one.

Consider the following list and find out if them helps:
http://world wide web.zytrax.com/tech/web/env_var.htm

You will need to utilize it such as this:

RewriteRule bla.png folder/%Title/file.png