rewrite rules on nginx

as previously i use apache for webservers, but now i want to migrate server to vps and i use nginx server. I have htaccess file here :

<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteRule ^/(.*).pdf$ /generator/pdfviewer.php?kiwod=$1 [L]
</IfModule>

and i try to rewrite with this script:

nginx configuration

location / { rewrite ^/(.*).pdf$ /generator/pdfviewer.php?kiwod=$1 break; }

but that script did not work . Please advise me for the correct script and where i put the code on nginx configuration?

please help me guys


Source: .htaccess

Leave a Reply