# Help needed with simple rewrite rule

**URL:** <https://www.ruby-forum.com/t/help-needed-with-simple-rewrite-rule/187120>\
**Category:** NGINX\
**Created:** [April 17, 2010, 3:16pm UTC](https://www.ruby-forum.com/t/help-needed-with-simple-rewrite-rule/187120 "2010-04-17T15:16:52Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![RoastedPeanut](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/f1d935/32.png) [@RoastedPeanut](https://www.ruby-forum.com/u/RoastedPeanut)\
**Post date:** [April 17, 2010, 3:16pm UTC](https://www.ruby-forum.com/t/help-needed-with-simple-rewrite-rule/187120/1 "2010-04-17T15:16:52Z")

</div>

Ok, so, I’ve been banging my head against the wall for an hour or so,  
and I feel an idiot…:

I’ve just moved a vbulletin 4 forum to nginx, and for some arcane  
reason,  
these URLs work: [http://mysite.com/forumdisplay.php?f=25](http://mysite.com/forumdisplay.php?f=25)  
but these do not  
[http://mysite.com/forumdisplay.php?25-Forum-Name](http://mysite.com/forumdisplay.php?25-Forum-Name)  
(the second URL is a built-in “friendly url” function in vb4)

So, since I couldn’t find anything in the logs, I decided I’m going to  
simply rewrite those non-functioning URLs to the functioning ones…

In short, I want to rewrite this:

[http://mysite.com/forumdisplay.php?25-Forum-Name](http://mysite.com/forumdisplay.php?25-Forum-Name)

to this:

[http://mysite.com/forumdisplay.php?f=25](http://mysite.com/forumdisplay.php?f=25)

My attempt is this:  
rewrite ^/forumdisplay.php?([0-9]+) /forumdisplay.php?f=$1;

Apparently, no matter how I escape it, inserting the “?” after  
forumdisplay.php causes the regex to not match at all.

Could any of you show me why it isn’t working, please?

Thanks

Posted at Nginx Forum:

> **[Help needed with simple rewrite rule](https://forum.nginx.org/read.php?2,76061,76061#msg-76061)**
>
> Ok, so, I've been banging my head against the wall for an hour or so, and I feel an idiot..: I've just moved a vbulletin 4 forum to nginx, and for some arcane reason, these URLs work: http://mysite.com/forumdisplay.php?f=25 but these do not...
