Location Rewrite Issue

Reinis Rozitis r at roze.lv
Fri Aug 16 09:14:50 UTC 2019

> I tried adding the following line in there in a couple different places but all it does is download the php file.
> location /blog { 
> rewrite ^/blog/([A-Za-z0-9-]+)/?$ /blog-article.php?slug=$1 break; 
> }

Try to switch from 'break' to 'last'.

By using 'break' it means that nginx stops the rewrite and also doesn't search for any other location so the request doesn't land in the 'location ~ \.php$' and is never processed by php.


More information about the nginx mailing list