简体   繁体   中英

Nginx pattern matching in location

I am trying to match all paths of particular pattern to some alias but it isn't working.

  location /*/ {
          alias /some/path;
  }

My requirement is that any url, eg http://<domain>/{variable} , should go to the alias and bring up the default page. The urls http://example.com/xyz/hello.html and http://example.com/abc/hello.html should resolve to the same location and refer to same page.

How do I achieve this?

Something like this:

rewrite ^/(.*)/(.*)$ /$2 last;

location / {
  root /home;
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM