Love Fuel?
Donate
About
Forums
Discussions
Login
FuelPHP Forums
Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
General
nginx rewrite php file to fuelphp
itcan
September 2014
Hi,
I want to do this:
- I have a device which calls test.php on my application, but I want to route this request to fuelphp.
for example:
http://www.example.com/test.php?var1=test&var2=test2
(this is called by my device) >> should route to
http://www.example.com/test1
?
var1=test&var2=test2
I have a routes.php in my fuelphp,
return array(
'test1' => 'api/test1',
);
This is my nginx config:
location = /test.php
{
try_files $uri $uri/ /index.php?/test1$is_args$args;
}
location ~ ^/index.php$
{
include /etc/nginx/custom/php.conf;
fastcgi_param FUEL_ENV production;
fastcgi_pass php;
}
but when I dump my $_GET array is see that the first element is not correct:
[test1?var1] => test
[var2] => test2
So how do I fix the try_files so it doesn't screw up my $_GET variables...
itcan
September 2014
got it.... REQUEST_URI had test.php in it...
fixed it this way:
location = /test.php
{
set $request_url /test1$is_args$args;
try_files $uri $uri/ /index.php$is_args$args;
}
location ~ ^/index.php$
{
include /etc/nginx/custom/php.conf;
fastcgi_param REQUEST_URI $request_url;
fastcgi_param FUEL_ENV production;
fastcgi_pass php;
}
Add a Comment
Howdy, Stranger!
It looks like you're new here. If you want to get involved, click one of these buttons!
Sign In
Apply for Membership
Categories
All Discussions
5,089
General
↳ General
3,364
↳ Job Board
13
↳ Installation & Setup
214
Packages
↳ Oil
213
↳ Orm
700
↳ Auth
261
Development
↳ Tips and Tutorials
126
↳ Code share
145
↳ Applications
52
In this Discussion
itcan
September 2014