'Rewrite Aspx to PHP on Nginx

On my Nginx server I need to rewrite all aspx requests to php.

    location ~ \.aspx$ {
  if (!-e $request_filename){
    rewrite ^(.*)\.aspx$ /$1.php;
  }
}

Whenever I try to load an aspx page the browser just downloads it.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source