Welcome! Log In Create A New Profile

Advanced

Re: Redirect ALL requests to single PHP file

António P. P. Almeida
January 18, 2012 11:46AM
On 18 Jan 2012 16h35 WET, nginx-forum@nginx.us wrote:

> Hi All,
>
> We'd like to redirect all requests to a single PHP file. The
> configuration below is what we have but I'm concerned that it would
> cause an "infinite" loop and possibly other problems. We'd like to
> redirect ANY request to api.php regardless if the file exists or
> not. Even a request to an existing static file should rewrite to
> the "api.php" file.
>
> Is this the correct way? is there a better way?

Try:

location = /api.php {
internal; # comment this out to allow direct access to api.php.
include fcgi;
fastcgi_pass 127.0.0.1:9000;
}

location / {
return 302 /api.php?uri=$request_uri;
}

--- appa

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Redirect ALL requests to single PHP file

iberkner January 18, 2012 11:35AM

Re: Redirect ALL requests to single PHP file

António P. P. Almeida January 18, 2012 11:46AM

Re: Redirect ALL requests to single PHP file

Maxim Dounin January 18, 2012 11:50AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 298
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready