rewrite, multiple slashes into set variables
September 19, 2009 10:22PM

just migrating my sites over from Apache to nginx and the speed difference is actually very noticeable even no a low volume server!

My problem is that in Apache I used a PHP trick to capture variables and values from an URI which I then fed to the database.

The trick was

//This only works with apache module.


$HTTP_PATH_VARS = array();

while( list($index,$key) = each($HTTP_TEMP_PATH_VARS) ) {
list($index,$val) = each($HTTP_TEMP_PATH_VARS);
$HTTP_PATH_VARS[$key] = $val;
$$key = $val;

My attempt at this is to make this rewrite:
if ($uri ~ "^(dagbok.php)(/.+)")
rewrite "/dagbok.php/(.*)/(.*)/(.*)/(.*)/(.*)/(.*)$" /dagbok.php?ar=$2&man=$4&dag=$6 last;

The URI looks like this:

and I need it interpreted into

I've trawled through the limited examples I've found and tried several versions but so far not been able to find a way for this to work.
Re: rewrite, multiple slashes into set variables
October 01, 2009 03:36PM
I was using the exact same trick and cannot figure out how to implement it with nginx.
I expected the trick to work out-of-the-box, as it does with apache and lighty, since it's related to php rather than the webserver
Right now it's a showstopper for me in migrating a large literature website to nginx, which works incredibly fast for the pages that don't rely on the trick .

Anyone has any clue on how this could be done? Slalfur, did you manage to find a solution?
Could you point me to what you've found on the topic?

MANY thanks!
Re: rewrite, multiple slashes into set variables
October 01, 2009 04:09PM
solved it thanks to this:,4041,4192#msg-4192

Edited 1 time(s). Last edit at 10/01/2009 04:10PM by radoo.
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 126
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready