Question

I added this lines into the virtual.conf in nginx. the redirection is working fine, but it downloads the file instead of opening it.

rewrite ^/img-(.*).html /img.php?id=$1 last;
rewrite ^/slide-(.*).html /slider.php?id=$1 last;
rewrite ^/page-(.*).html /page.php?name=$1 last;
rewrite ^/contact.html$ /contact.php last;

I was trying to translate this .htaccess to nginx:

Options +FollowSymlinks
Options -MultiViews
RewriteEngine On
RewriteBase /
RewriteRule ^img-(.*).html img.php?id=$1 [L]
RewriteRule ^slide-(.*).html slider.php?id=$1 [L]
RewriteRule ^page-(.*).html page.php?name=$1 [L]
RewriteRule ^contact.html$ contact.php [QSA,L,NC]
Was it helpful?

Solution 2

nginx was old. I needed to update it.

OTHER TIPS

I guess… no PHP installed? I would try to show a simple page With PHP info command. In this context it is probably better to talk about execution not to open .

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top