0

For some reason, the rewrite to location /ancient/ isn't working.

If I switch out "/ancient/" for "http://google.com" (or any URL), the rewrite works. So I know my check for IE 6 is working.

Also, if I try to directly access /etc/static/ancient/ directly from the browser, I can. So I know the desired files are accessible.

location / {

    if ($http_user_agent ~ "MSIE 6.0") {
        rewrite ^ /ancient/;
        break;
    }
}

location /ancient/ {
    alias /Users/myusernametho/sterling/etc/static/ancient/;
}

I've run this on BrowserStack and with curl (UA spoofing) with the same results.

Am I misunderstanding something about how the rewrite directive works?

Bryce Johnson
  • 6,689
  • 6
  • 40
  • 51

1 Answers1

0

There is a need for the optional flag parameter(break, last, redirect) in your rewrite. in your case. You forgot to write the break at the end of your rewrite directive like so:

rewrite ^ /ancient/ break;

and you don't need the break at the end of the if

skip87
  • 529
  • 1
  • 7
  • 27