Variable for the suffix of $request_uri that didn't match the location block prefix
- by hsivonen
Suppose I want to move an /images/ directory to an images host so that what was before http://example.org/images/foo.png becomes http://images.example.org/foo.png.
If I do: location /images/ { return 301 http://images.example.org$request_uri; }, the result is a redirect to http://images.example.org/images/foo.png which isn't what I want.
An older question has an answer that suggests using a regexp location, but that seems like an overkill.
Is there really no way to refer to $request_uri with the location prefix chopped off without using regular expressions? Seems like an obvious feature to have.