{"id":2604,"date":"2020-03-31T11:52:41","date_gmt":"2020-03-31T10:52:41","guid":{"rendered":"https:\/\/ibex.tech\/cloud\/?p=2604"},"modified":"2025-03-30T10:47:33","modified_gmt":"2025-03-30T09:47:33","slug":"redirect-to-page","status":"publish","type":"post","link":"https:\/\/ibex.tech\/cloud\/wordpress\/pages-wordpress\/redirect-to-page","title":{"rendered":"Redirect to page"},"content":{"rendered":"\n<h4 class=\"wp-block-heading\">Before outputting page content<\/h4>\n\n\n\n<h5 class=\"wp-block-heading\">Redirect based on the home URL<\/h5>\n\n\n\n<pre class=\"wp-block-code\"><code>      wp_redirect( home_url( '\/' ) );\n      die;\n\n\n      wp_redirect( home_url( '\/my_page_name' ) );\n      die;<\/code><\/pre>\n\n\n\n<h5 class=\"wp-block-heading\"> Redirect based on the site URL <\/h5>\n\n\n\n<pre class=\"wp-block-code\"><code>      wp_redirect( site_url() );\n      exit;<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">If you\u2019ve outputted some page content<\/h4>\n\n\n\n<p>Using a META tag is the easiest way<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>  die('&lt;META HTTP-EQUIV=\"refresh\" content=\"0;URL=\/some_page\"&gt;');\n<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Redirect on &#8220;Page not found&#8221;<\/h4>\n\n\n\n<p>Create a page called 404.php. Place this code in it:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;?php\n\n\/\/Redirect to home page if page is not found\nwp_redirect(home_url());\nexit;\n\n?><\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Before outputting page content Redirect based on the home URL Redirect based on the site URL If you\u2019ve outputted some page content Using a META tag is the easiest way Redirect on &#8220;Page not found&#8221; Create a page called 404.php. Place this code in it:<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[120],"tags":[],"class_list":["post-2604","post","type-post","status-publish","format-standard","hentry","category-pages-wordpress"],"_links":{"self":[{"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/posts\/2604","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/comments?post=2604"}],"version-history":[{"count":5,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/posts\/2604\/revisions"}],"predecessor-version":[{"id":4793,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/posts\/2604\/revisions\/4793"}],"wp:attachment":[{"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/media?parent=2604"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/categories?post=2604"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/tags?post=2604"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}