note 45121 added to migration5.incompatible
| From: | john dot g at osu1 dot php dot net | Date: | Thu, 26 Aug 2004 17:45:41 +0000 |
| Subject: | note 45121 added to migration5.incompatible | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-75346@lists.php.net to get a copy of this message | ||
PATH_TRANSLATED is handy when using Apache's ModRewrite engine, as it gives you the name and
path of the resulting file rather than the one that was requested by the user. Since PHP 5.0 and
Apache 2 no longer support this variable, I created a workaround by adding an environment variable
to my ModRewrite command:
Original:
RewriteRule ^/test/(.*)\.php(.*) /test/prefix_$1.php$2
Adjusted:
RewriteRule ^/test/(.*)\.php(.*) /test/prefix_$1.php$2 [E=TARGET:prefix_$1.php]
I could then find out the resulting file name through the super global $_ENV, for instance:
<?php
echo "The actual filename is ".$_ENV['REDIRECT_TARGET'];
?>
Note: The "REDIRECT_" prefix appears to be allocated automatically by ModRewrite.
----
Manual Page -- http://www.php.net/manual/en/migration5.incompatible.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+45121
Delete -- http://master.php.net/manage/user-notes.php?action=delete+45121&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+45121&report=yes
Search -- http://master.php.net/manage/user-notes.php