# Nginx 1.2.3 Rewrite Issue

**URL:** <https://www.ruby-forum.com/t/nginx-1-2-3-rewrite-issue/222033>\
**Category:** NGINX\
**Created:** [August 9, 2012, 4:14pm UTC](https://www.ruby-forum.com/t/nginx-1-2-3-rewrite-issue/222033 "2012-08-09T16:14:51Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![aris](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/258eb7/32.png) [@aris](https://www.ruby-forum.com/u/aris)\
**Post date:** [August 9, 2012, 4:14pm UTC](https://www.ruby-forum.com/t/nginx-1-2-3-rewrite-issue/222033/1 "2012-08-09T16:14:51Z")

</div>

Wierd problem with Nginx 1.2.3 rewrites.

See [http://pastie.org/4433865](http://pastie.org/4433865) and note Line 30. The arg is part of the  
main url. Results in a 404 not found as the final url becomes  
“/test/index.php?x2\_SID=41efad7adffaa9d25967dc913919cbc0?x2\_SID=41efad7adffaa9d25967dc913919cbc0”

Any cluees

---

<div class="post-metadata">

**Author:** ![Nginx\_U](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/dec6dc/32.png) [@Nginx\_U](https://www.ruby-forum.com/u/Nginx_U)\
**Post date:** [August 9, 2012, 4:20pm UTC](https://www.ruby-forum.com/t/nginx-1-2-3-rewrite-issue/222033/2 "2012-08-09T16:20:42Z")

</div>

Hello!

On Thu, Aug 09, 2012 at 05:13:53PM +0300, Nginx U. wrote:

> Wierd problem with Nginx 1.2.3 rewrites.
> 
> See [http://pastie.org/4433865](http://pastie.org/4433865) and note Line 30. The arg is part of the  
> main url. Results in a 404 not found as the final url becomes

“/test/index.php?x2\_SID=41efad7adffaa9d25967dc913919cbc0?x2\_SID=41efad7adffaa9d25967dc913919cbc0”

> Any cluees

It’s not clear what you are trying to do, but if you just want to  
preserve arguments as is - there is no need to write anything  
extra, just

rewrite ^/test/index.html$ /test/index.php last;

Original request arguments (if any) will be preserved as is.

Maxim D.

---

<div class="post-metadata">

**Author:** ![Nginx\_U](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/dec6dc/32.png) [@Nginx\_U](https://www.ruby-forum.com/u/Nginx_U)\
**Post date:** [August 9, 2012, 4:27pm UTC](https://www.ruby-forum.com/t/nginx-1-2-3-rewrite-issue/222033/3 "2012-08-09T16:27:43Z")

</div>

Ha! Got it. I was trying to preserve arguments indeed.

I take it this is related to needing to add a “?” to the end of such  
to prevent the args being appended again. Right?

---

<div class="post-metadata">

**Author:** ![Nginx\_U](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/dec6dc/32.png) [@Nginx\_U](https://www.ruby-forum.com/u/Nginx_U)\
**Post date:** [August 9, 2012, 4:29pm UTC](https://www.ruby-forum.com/t/nginx-1-2-3-rewrite-issue/222033/4 "2012-08-09T16:29:28Z")

</div>

Hello!

On Thu, Aug 09, 2012 at 05:26:40PM +0300, Nginx U. wrote:

> Ha! Got it. I was trying to preserve arguments indeed.
> 
> I take it this is related to needing to add a “?” to the end of such  
> to prevent the args being appended again. Right?

For sure.

Maxim D.
