server {
server_name "upload.example.com";
location ^~ /page {
return 301 http://example.com$uri;
}
}
Or if all your upload pages can be identified via a specific portion within the URL.
server {
server_name "upload.example.com";
location / {
location ~* "^(?!.*?upload).*$" {
return 301 http://example.com$uri;
}
}
}
Or if you only have a single valid location.
server {
server_name "upload.example.com";
location = /upload-script {
# Code to process upload
}
# Redirect anything else!
location / {
return 301 http://example.com$uri;
}
}