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.

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;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.