0

I'm trying to configure a workaround for google's WontFix search behavior in nginx by having a simple subfolder for my searches.

So far this is what I have.

 location ~* ^/search/(.*\..*)$ {
    return 307 http://$1;
  }
 location ~* ^/search/(.*)$ {
    return 307 https://www.google.com/search?q=$1;
  }

However this matches spaces, how can I update the first location block to only match non-whitespace characters.

Jacob Evans
  • 7,636
  • 3
  • 25
  • 55

1 Answers1

0

Replaced * with \S+ was all I needed. (found what I needed in another exchange)

 location ~* ^/search/(.\S+\..\S+)$ {
    return 307 http://$1;
  }
 location ~* ^/search/(.*)$ {
    return 307 https://www.google.com/search?q=$1;
  }
Jacob Evans
  • 7,636
  • 3
  • 25
  • 55