3

I'm using the following syntax for my rewrite in NGINX, and as far as I see it's working right! :

    location / {
         if (!-e $request_filename){
            rewrite ^(.+)$ /index.php?url=$1 break;
         }
    }

It's leading me through a login page written in PHP, but there are a problems occurring: It downloads the login page instead of showing it!

Does anybody know why it is happening? I'm using NGINX with php-fpm on CentOS 7.

Jeff Schaller
  • 66,199
  • 35
  • 114
  • 250
Parsa Samet
  • 767
  • 1
  • 7
  • 20

1 Answers1

2

Change the break to last. i.e. :

It should be:

rewrite ^/(.+)$ /index.php?p=$1 last; 

Instead of:

rewrite ^(.+)$ /index.php?url=$1 break;