<link href="https://fonts.googleapis.com/css?family=Roboto:100,100italic,200,200italic,300,300italic,400,400italic,500,500italic,600,600italic,700,700italic,800,800italic,900,900italic&amp;display=swap" rel="stylesheet"/>
1 minute reading time (79 words)

Nginx Rewrite Rule - 301 Redirect One Page to Another URL

How to create a 301 permanent redirect for one page to another URL using the Nginx return directive 

Example: Nginx 301 Redirect one page to another URL

Old page https://youdomain.com/categories/azure/disable-welcome-to-acrobat-reader-message-using-registry
New page https://yourdomain.com/categories/guides/disable-welcome-to-acrobat-reader-message-using-registry

In this example, the redirect location is inside the server https block

location = /categories/azure/disable-welcome-to-acrobat-reader-message-using-registry {
  return 301 /categories/guides/disable-welcome-to-acrobat-reader-message-using-registry;
}
 

For redirecting a path for multiple URLs, see this guide:

Nginx Rewrite Rule - 301 Redirect to Another Path for Multiple URLs
https://techlabs.blog/categories/guides/nginx-rewrite-rule-301-redirect-to-another-path-for-multiple-urls

Related Posts

 

Comments

No comments made yet. Be the first to submit a comment
Already Registered? Login Here
Saturday, 13 September 2025
You can help support this website by buying me a coffee!
Buy Me A Coffee