{"id":147,"date":"2006-11-14T20:04:00","date_gmt":"2006-11-15T01:04:00","guid":{"rendered":"http:\/\/wangxiaohu.com\/blog\/?p=147"},"modified":"2006-11-14T20:04:00","modified_gmt":"2006-11-15T01:04:00","slug":"temporary-redirection-plugin-for-wordpress","status":"publish","type":"post","link":"https:\/\/wangxiaohu.com\/blog\/?p=147","title":{"rendered":"Temporary Redirection Plugin for WordPress"},"content":{"rendered":"<p>When people visit <em>His Story<\/em> with URL <a href=\"http:\/\/www.wangxiaohu.com\">www.wangxiaohu.com<\/a>, I always want it automatically goes to <a href=\"http:\/\/wangxiaohu.com\">wangxiaohu.com<\/a> in order to be consistent. So I wrote this plugin for personal use.<\/p>\n<p>It redirects the current URL to another URL with desired domain name. The source code is <a href=\"http:\/\/wangxiaohu.com\/wp-content\/uploads\/2006\/11\/redirector.txt\">here<\/a>:<br \/>\n<iframe loading=\"lazy\" src=\"http:\/\/wangxiaohu.com\/wp-content\/uploads\/2006\/11\/redirector.txt\" frameborder=\"0\" height=\"450\" width=\"450\"> <\/iframe><br \/>\nThe plugin first checks if <strong>HTTP_HOST<\/strong> equals <strong>$target_host<\/strong> (In my case, it&#8217;s &#8220;<strong>wangxiaohu.com<\/strong>&#8220;). If it doesn&#8217;t, the plugin simply replaces <strong>HTTP_HOST <\/strong>with <strong>$target_host<\/strong> and provides a 307 header for temporary redirection.<\/p>\n<p>To install,<\/p>\n<ol>\n<li>Give <strong>$target_host<\/strong> a new value<\/li>\n<li>Rename the file to extension <strong>.php<\/strong><\/li>\n<li>Upload it to WordPress <strong>wp-content\/plugins<\/strong> directory.<\/li>\n<\/ol>\n<p><em>WARNING<\/em>: <em>This plugin is not guaranteed to be problem free. Use it at your own risk.<\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>When people visit His Story with URL www.wangxiaohu.com &hellip; <a href=\"https:\/\/wangxiaohu.com\/blog\/?p=147\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">Temporary Redirection Plugin for WordPress<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":"","_jetpack_memberships_contains_paid_content":false},"categories":[1],"tags":[],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","jetpack_likes_enabled":true,"jetpack-related-posts":[],"jetpack_shortlink":"https:\/\/wp.me\/pdhZ2A-2n","_links":{"self":[{"href":"https:\/\/wangxiaohu.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/147"}],"collection":[{"href":"https:\/\/wangxiaohu.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wangxiaohu.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wangxiaohu.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/wangxiaohu.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=147"}],"version-history":[{"count":0,"href":"https:\/\/wangxiaohu.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/147\/revisions"}],"wp:attachment":[{"href":"https:\/\/wangxiaohu.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=147"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wangxiaohu.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=147"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wangxiaohu.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=147"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}