title: Nginx: Escaping # in url rewrite
body: <p>I have a MVC JavaScript application that needs to support Facebook sharing, which means it needs to support unique OG meta HTML tags. </p>
  
  <p>I'm doing an Nginx rewrite that will detect the Facebook crawler to server a custom version of the app with the proper OG tag for that section but Apache is ignore everything after the # sign (as server-side should do since that's a browser feature.) I would like to escape the "#" in my rewrite but am not sure how to do it in Nginx:</p>
  
  <pre><code>location / {
    if ($http_user_agent ~* 'facebookexternalhit') {
      rewrite ^(.*)$ /og.php?url=http://$host$uri;
      proxy_pass http://127.0.0.1:8080;
      break;
    }
    root /var/www/html/site.net;
  }
  </code></pre>
  
  <p>Thanks for taking a look!</p>