Welcome! Log In Create A New Profile

Advanced

request_uri rewrite not working

Posted by Ciprian 
request_uri rewrite not working
February 25, 2012 12:07AM
Hi Gents,

I need some help doing a rewrite which in my opinion is triky.

I have this:

if ($request_uri ~* ".*/home/purchase.php\?afl=1659\&rs=\&pid=9\&cid=\&lid=$") {
set $args "";
rewrite ^.*$
https://my-domain/home/purchase.php?afl=1659&rs=&pid=9&cid=&lid=&promocode=U01Ng1dlzqVeHjuROylCeMXT permanent;

I have, 'afl' and 'pid' which have constant values and the rest are variables(this means they are getting different values). How can I make this redirect work ? I have spent a lot of hours figuring and got nothing but a headache.

Please help.

Cheers.
Re: request_uri rewrite not working
February 25, 2012 01:35AM
Okay, maybe I wasn't very clear above.

Let's try again.

I need this url: https://my_shopping_store.com/home/purchase.php?afl=1183&rs=2&pid=9&cid=BkAG8ALwBjAG8AbQBwAHUAdABlAHIALQBzAGg&lid=AEMAbwBtAHAAdQB0AGUAcgAgAFMAaABvAHAAIABvAH

to be redirected to the same url and just append this string "&promocode=U01Ng1dlzqVeHjuROylCeMXT" to it's tail.

As as said in previous post, only "rs", "cid" and "lid" values are changing.

I also tried this:

if ($request_uri ~* ".*/home/purchase.php\?afl=1659\&rs=[0-9]\&pid=9\&cid=([0-9][a-z])\&lid=([0-9][a-z]$") {
set $args "";
rewrite ^.*$
https://my-domain.com/home/purchase.php?afl=1659&rs=&pid=9&cid=&lid=&promocode=U01Ng1dlzqVeHjuROylCeMXT permanent;
}

Unfortunately, isn't working.

Any ideas?
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 143
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready