nginx block URI request but allow internal directory
- by Mike Anders
I'm new to nginx from apache. I'm trying to simply block the URIs:
/_mydir/* = / (redirect)
But, I want to rewrite:
/ex/(.*)$ = /_mydir/$1
I have tried:
location /ex/ {
rewrite ^/ex/(.*)$ /_mydir/$1 last;
}
location /_mydir {
rewrite ^/_mydir/(.*)$ http://$http_host/ redirect;
}
But what always happens is once I block the…