How could I permanently redirect dynamic url with querystrings?

Gena Makhomed gmm at csdoc.com
Sat Jun 19 18:28:06 MSD 2010


On 19.06.2010 16:53, WisdomFusion wrote:

> #rewrite dynamic url with querystrings
> if ($args ~* "boardid=[0-9]+&id=([0-9]+)") {
>    set $tid $1;
>    rewrite ^.*$ http://www2.example.com/thread-$tid-1-1.html permanent;

- rewrite ^.*$ http://www2.example.com/thread-$tid-1-1.html permanent;
+ rewrite ^ http://www2.example.com/thread-$tid-1-1.html? permanent;

> #at the end, rewrite undefined urls permanently
> rewrite ^(.*) http://www2.example.com$1 permanent;

- rewrite ^(.*) http://www2.example.com$1 permanent;
+ rewrite ^ http://www2.example.com$request_uri? permanent;

-- 
Best regards,
  Gena



More information about the nginx mailing list