NGINX pros of Twitter -- I need to redirect a certain file request by adding a prefix directory. For example, requests for the file /openapi.json should redirect to /reddit/openapi.json.
Anyone know how to do this? I've searched Google but having a hard time finding an example
Conversation
Replying to
server { ...
# If starts with string, use regex to rewrite string.
location ~* ^/openapi.json { rewrite ^/openapi.json(.*)$ /reddit/openapi.json$1 break; }
}
2
Replying to
Sounds like you don't need a redirect, it sounds like you need a rewrite rule.


