Complete the code to rewrite all requests to /home.
rewrite [1] /home;The rewrite directive uses a regular expression to match the request URI. ^/.*$ matches any URI starting with a slash.
Complete the code to redirect requests from /old to /new permanently.
rewrite ^/old[1] /new permanent;The pattern ^/old$ matches exactly the URI /old for rewriting.
Fix the error in the rewrite directive to capture the path after /blog/ and redirect to /news/.
rewrite ^/blog/[1] /news/$1 permanent;
The capture group (.*) captures any characters after /blog/ to use in the replacement.
Fill both blanks to rewrite requests ending with .php to .html internally.
rewrite [1] [2] last;
The pattern ^(.*)\.php$ matches URIs ending with .php and captures the part before it. The replacement \1.html rewrites to the same path but with .html extension.
Fill all three blanks to rewrite URLs with query parameters to a clean URL format.
rewrite ^/product/[1]/details\?id=[2]$ /item/[3] last;
The first capture group ([a-zA-Z0-9_-]+) captures the product name. The second ([0-9]+) captures the id query parameter. The replacement uses $2 to insert the id in the clean URL.