Reputation: 51
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:
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
Upvotes: 0
Views: 225
Reputation: 824
Try to put rewrite outside of location, in server:
server {
listen 80;
server_name www.example.org example.org;
rewrite (.*) http://www.example.org$1;
}
...
}
Upvotes: 1