{"id":4971,"date":"2026-04-01T10:14:01","date_gmt":"2026-04-01T10:14:01","guid":{"rendered":"https:\/\/tinyurl.com\/blog\/?p=4971"},"modified":"2026-04-07T16:13:19","modified_gmt":"2026-04-07T16:13:19","slug":"redirect-nginx-server","status":"publish","type":"post","link":"https:\/\/tinyurl.com\/blog\/redirect-nginx-server\/","title":{"rendered":"How to Redirect on Nginx Server"},"content":{"rendered":"\n<p style=\"font-size:16px\">This will cover instructions on how to create a Redirect on Nginx. The following steps will&nbsp;<strong>require ownership or control of the site your TinyURL points to<\/strong>. As these changes may lead to an interruption of service for your website, if you don&#8217;t have or you are unsure how to proceed, please consult with your IT, hosting provider or Web Development team.<\/p>\n\n\n\n<div style=\"height:50px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Nginx Server<\/h3>\n\n\n\n<div style=\"height:16px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p style=\"font-size:16px\">Redirection on Nginx can we accomplish using many ways, but the most common way to redirect by creating the server block using the&nbsp;<em>return<\/em>&nbsp;Directive.<\/p>\n\n\n\n<div style=\"height:16px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<ol class=\"wp-block-list\">\n<li style=\"font-size:16px\">Log on to your Dedicated Nginx server using Administrator account\/access.<\/li>\n<\/ol>\n\n\n\n<div style=\"height:16px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<ol start=\"2\" class=\"wp-block-list\">\n<li style=\"font-size:16px\">Create a file named the &#8216;<em>redirects.conf<\/em>&#8216; file in your &#8216;<em>\/nginx.example.com<\/em>&#8216; directory.<\/li>\n<\/ol>\n\n\n\n<div style=\"height:16px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<ol start=\"3\" class=\"wp-block-list\">\n<li style=\"font-size:16px\">On your &#8216;<em>redirects.conf<\/em>&#8216; file, add the contents below to to create a redirect:To redirect a\u00a0<strong>specific page<\/strong>\u00a0:<code>if ($request_filename ~ oldfile.html){ rewrite ^ http:\/\/example.com\/newfile.html? permanent; }<\/code>To redirect an\u00a0<strong>entire site<\/strong>\u00a0:<code>if ($request_filename ~ \/*){ rewrite ^ http:\/\/example.com? permanent; }<\/code><\/li>\n<\/ol>\n\n\n\n<div style=\"height:25px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p style=\"font-size:16px\"><strong>Note<\/strong>&nbsp;: Remember to substitute and validate that you have the correct html file names and domain names on these instructions:<\/p>\n\n\n\n<div style=\"height:16px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<ul class=\"wp-block-list\">\n<li>&#8216;*oldfile*&#8217;      : This is the html file for your old page<\/li>\n<\/ul>\n\n\n\n<div style=\"height:16px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<ul class=\"wp-block-list\">\n<li>&#8216;*newfile*&#8217;      : This is the html file for your new page<\/li>\n<\/ul>\n\n\n\n<div style=\"height:16px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<ul class=\"wp-block-list\">\n<li>&#8216;*example.com*&#8217;  : This is the root web folder of the new site<\/li>\n<\/ul>\n\n\n\n<div style=\"height:25px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<ol start=\"4\" class=\"wp-block-list\">\n<li style=\"font-size:16px\">For the changes to take effect, after you insert these commands to your &#8216;<em>redirects.conf<\/em>&#8216; file,\u00a0<strong>Reload<\/strong>\u00a0Nginx by running the command\u00a0<code>[server]$ sudo \/etc\/init.d\/nginx reload<\/code>. If you&#8217;re on a VPS (private server), click on the\u00a0<strong>Restart<\/strong>\u00a0button of your server.<\/li>\n<\/ol>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This will cover instructions on how to create a Redirect on Nginx. The following steps will&nbsp;require ownership or control of the site your TinyURL points to. As these changes may lead to an interruption of service for your website, if you don&#8217;t have or you are unsure how to proceed, please consult with your IT, [&hellip;]<\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[60],"tags":[66],"class_list":["post-4971","post","type-post","status-publish","format-standard","hentry","category-help","tag-other-help-content"],"_links":{"self":[{"href":"https:\/\/tinyurl.com\/blog\/wp-json\/wp\/v2\/posts\/4971","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tinyurl.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tinyurl.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tinyurl.com\/blog\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/tinyurl.com\/blog\/wp-json\/wp\/v2\/comments?post=4971"}],"version-history":[{"count":1,"href":"https:\/\/tinyurl.com\/blog\/wp-json\/wp\/v2\/posts\/4971\/revisions"}],"predecessor-version":[{"id":4973,"href":"https:\/\/tinyurl.com\/blog\/wp-json\/wp\/v2\/posts\/4971\/revisions\/4973"}],"wp:attachment":[{"href":"https:\/\/tinyurl.com\/blog\/wp-json\/wp\/v2\/media?parent=4971"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tinyurl.com\/blog\/wp-json\/wp\/v2\/categories?post=4971"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tinyurl.com\/blog\/wp-json\/wp\/v2\/tags?post=4971"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}