The requested URI must be a case-sensitive match for the specified regular expression:
server { server_name website.com; location ~ ^/abcd$ { [...] } }
The ^/abcd$ regular expression used in this example specifies that the pattern must begin (^) with /, be followed by abc, and finish ($) with d. Consequently, the configuration in the location block:
- Applies to http://website.com/abcd (exact match)
- Does not apply to http://website.com/ABCD (case-sensitive)
- Applies to http://website.com/abcd?param1¶m2 (regardless of query string arguments)
- Does not apply to http://website.com/abcd/ (trailing slash) due to the specified regular expression
- Does not apply to http://website.com/abcde (extra characters) due to the specified regular expression
With operating systems such as Microsoft Windows, ~ and ~* are both case-insensitive, as the OS uses a case-insensitive filesystem.