Home > Blockchain >  How to rewrite /file/(name) to /q.html?id=(name) in NGINX
How to rewrite /file/(name) to /q.html?id=(name) in NGINX

Time:08-02

For example, rewriting /file/example to /q.html?id=example or /file/test to /q.html?id=test using NGINX.

How would that look like?

CodePudding user response:

There are a number of ways of preforming an external redirect in Nginx, but the simplest solution would be:

rewrite ^/file/(. )$ /q.html?id=$1 redirect;

See this document for details.

  • Related