A narrow path redirect example for Nginx. Test syntax and Location headers before using permanent redirects widely.
Nginx snippet
server {
listen 80;
server_name example.com;
location = /old-page {
return 301 https://example.com/new-page;
}
}
How to use this example
- Paste into the matching server block or adapt as a separate block.
- Run nginx -t before reload.
- Verify with curl -I http://example.com/old-page.
Notes
- Use 302 while testing uncertain redirects.
- Avoid duplicating the same redirect in CDN and app code.
Related tools and fixes
Last updated: May 18, 2026