nginx: rewrite a non-existent php-file to another php-file with all arguments
- by at0m33
i really need help here. Sitting for some time now and dont figured it out.
I want to realize a very simple task - rewrite a non-existent php file to another existant php file with all arguments like:
this http://example.com/nonexistent.php?url=google.com
to -> http://example.com/existent.php?url=google.com
I tried something like this:
rewrite ^/nonexistent.php /existent.php;
Which dont works (File not found). But redirect a non-existent html file to a php file like this:
rewrite ^/nonexistent.html /existent.php;
works.
I dont want to rewrite a html file, but this is still a confusing behaviour.
Therefore it tried also something like this (and some variations):
rewrite ^/nonexistent.php?url=^(.*)$ /existent.php?url=$1;
which is also not working. (Maybe the syntax is bad)
Any help here? It would be very nice!