0

What is the best way to write location directive for long list of url prefixes

location ~ ^/someUrl/par1/|^/someUrl/par3/|^/someUrl/par2/|^/someUrl/par4/|^/someUrl/par5/ {
   return 404;
} 

This list grows very fast. I can't use map directive. I the have list of prefixes, not full paths.

Is it possible to put prefixes to separate file?

  • Why do you not want to use a map directive? – Richard Smith Jan 15 '18 at 15:07
  • @RichardSmith how I can do prefix filtration with map? – demon101 Jan 15 '18 at 15:46
  • See this answer. – Richard Smith Jan 15 '18 at 15:56
  • @RichardSmith you can use map directive only with url full match – demon101 Jan 16 '18 at 20:15
  • You can also use regular expressions. – Richard Smith Jan 16 '18 at 20:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.