If the user types www.mysite.com/foo.php
, if the file foo exist the server respond with foo, but if the file does not exist, it needs to rewrite like this: www.mysite.com/url.php?url=foo.php
Im trying this on nginx:
location / {
include /etc/nginx/global/*;
#try_files $uri $uri/ /index.html;
if (!-e $request_filename){
rewrite ^(.*)$ /url.php?url=$1 break;
}
}
But instead of rendering the page (when the file is not present), the browser downloads it. Why?
try_files
, notrewrite
.