req.url.dirname

STRING, read-only.

Available inall subroutines.

The directories specified in a URL. This will be from the beginning of the URL up to the last /, not including the query string. The last / will not be part of req.url.dirname unless req.url.dirname is / (the root directory).

Examples

In the request www.example.com/1/hello.gif?foo=bar, req.url.dirname will contain /1.

In the request www.example.com/5/inner/hello.gif?foo=bar, req.url.dirname will contain /5/inner.

User contributed notes

BETA

Do you see an error in this page? Do you have an interesting use case, example or edge case people should know about? Share your knowledge and help people who are reading this page! (Comments are moderated; for support, please contact Fastly support)