This should work. Basically it captures the string after the slash, before the end of the string, and calls site with that string as the parameter
location /
rewrite ^/(website)$ /site?$1;
}
The browser needs to use a URL such as http://example.com/abcd , internally Nginx will call http://example.com/site=abcd . You obviously need to have a location set up that will respond to requests on that url. For example
location /site
proxy_pass localhost:1234;
}
I did a test using a plain Nginx configuration, which only differs from the above with the .html extension required for the test.
server {
listen 80;
server_name test1.example.com;
location / {
root /var/www/test1;
rewrite ^/(website).html$ /site.html?$1;
}
}
I created two files, website.html and site.html, with contents being their filename. Without the rewrite the browser shows "website". With the rewrite it shows "site". This proves to me the test configuration works.