location = robots.txt { allow all; log_not_found off; access_log off; } location = explore/ { index index.html } location ~* explore/(.*)/ { if ($request_uri ~ ^/(.*)\.html) { return 302 explore/$1/; } try_files $uri $uri.html $uri/ =404; } }