ISAPI Rewrite 3.0 REQUEST_URI work around

1

Helicon Tech have taken quite a different approach with the release of ISAPI Rewrite 3 in that they have adopted a structure that is very much like mod_rewrite for Apache. ISAPI Rewrite 3 now can read rewrite rules directly from Apache .access files without the user needing to do a thing. Although ISAPI Rewrite 3 is very similar to mod_write for Apache now, there are a few things that do not work the same. Take the REQUEST_URI server variable for instance which doesn't work with IIS as IIS doesn't allow the modification of server variables. What Helicon did here was make their own variable called HTTP_X_REWRITE_URL which does allow the modification of server variables. The only drawback is that this then requires you to replace REQUEST_URI with HTTP_X_REWRITE_URL in all you code, or does it?

Replacing REQUEST_URI with HTTP_X_REWRITE_URL in all your code is certainly one way to do it, but it isn't very practical and also makes your code platform dependent because of ISAPI Rewrite 3. Another way to do it is to use the "auto_prepend_file" directive in php.ini to run some code prior to each script to assign the value of HTTP_X_REWRITE_URL to REQUEST_URI. To do this create a file called "request_uri.php" or similar and enter the following code into it;

<?php
if (isset($_SERVER['HTTP_X_REWRITE_URL']))
{
$_SERVER['REQUEST_URI'] = $_SERVER['HTTP_X_REWRITE_URL'];
}
?>


Next, open your php.ini file and find the following directive;

auto_prepend_file =


Now set the value to the full path to the php file you just created, for example;


auto_prepend_file = D:\php\request_uri.php


Restart IIS and you should now have the REQUEST_URI variable available to all of your PHP scripts without altering a single line of code which is very handy. For instance the Drupal CMS uses REQUEST_URI when testing for clean URL compatibility, and with the above set Drupal finally passes this test when hosted on IIS.

Labels: ,
Loading related posts...

1 comments:

December 5, 2022 at 2:23 PM
Anonymous said...

So far online playing – which also contains taking part in} on mobile on line casino sites – is just out there in select states. However, there is be} important confidence that online playing will quickly take pleasure in related expansion to that seen by authorized online sports activities betting. As far as the precise product goes, MaximBet’s app and website present its gamers with a darkish, 카지노 cool shade scheme, modern graphics, and an total solid betting expertise.


Post a Comment

2010 WEBSITE20. All rights reserved.