3

I have the following apache rewrite rule:

RewriteEngine On
RewriteRule ^id/([^/\.]+)$ item.php?id=$1 [L]

and I need to be able to use it with Nginx. It is meant to so that someone can go to http://mysite.com/id/10 and instead of having to be go http://mysite.com/item.php?id=10. Can anyone help me convert it?

Thanks in advance!

Book Of Zeus
  • 49,509
  • 18
  • 174
  • 171

2 Answers2

8

you mean like this:

rewrite ^/id/([0-9]+)/?$ /item.php?id=$1 last;
Book Of Zeus
  • 49,509
  • 18
  • 174
  • 171
2

This should do the trick:

 rewrite ^/id/([^/\.]+)$ /item.php?id=$1 last;
dmitrig01
  • 744
  • 4
  • 15