August 2017
Intermediate to advanced
278 pages
8h 53m
English
If you want everything within a whole directory to redirect, this can also be easily covered with one line:
rewrite ^/oldproduct/?(.*)$ /newproduct/$1 redirect;
Again, this needs to go within your existing server block directive. While similar to the single page, there are a few key differences. First, we add a subexpression (.*), which we then pass to the new URL as a variable ($1).
For example, if we call the /oldproduct/information URL, it will redirect to /newproduct/information. This will match anything in the URL, so if you have parameters in the call (for example, id=1), these will also be passed to the new URL.
Read now
Unlock full access