location / { if (-f $request_filename) { break; } rewrite ^ http://example.com$request_uri? permanent }