Nginx rewrite rules, some work, some don't

Posted by Lawrence Goldstien on Server Fault See other posts from Server Fault or by Lawrence Goldstien
Published on 2012-06-28T08:46:40Z Indexed on 2012/06/28 9:17 UTC
Read the original article Hit count: 254

Filed under:
|

Here are the two rewrite rules:

This one works

rewrite ^/knowledgebase/([0-9]+)/[a-z0-9_-]+.html$ /./knowledgebase.php?action=displayarticle&id=$1 last;

This one doesn't

rewrite ^/announcements/([0-9]+)/[a-z0-9_-]+.html$ /./announcements.php?id=$1 last;

There is no difference between the two as far as I can see. The url to be rewritten for announcements is:

/announcements/2/New-Site-Design.html

And should be rewritten to:

/announcements.php?id=2

I really can't see how the announcements one doesn't work compared to the knowledgebase one. Any tips would be greatly appreciated.

© Server Fault or respective owner

Related posts about nginx

Related posts about rewrite