Temporary Redirection Plugin for WordPress

When people visit His Story with URL www.wangxiaohu.com, I always want it automatically goes to wangxiaohu.com in order to be consistent. So I wrote this plugin for personal use.

It redirects the current URL to another URL with desired domain name. The source code is here:

The plugin first checks if HTTP_HOST equals $target_host (In my case, it’s “wangxiaohu.com“). If it doesn’t, the plugin simply replaces HTTP_HOST with $target_host and provides a 307 header for temporary redirection.

To install,

  1. Give $target_host a new value
  2. Rename the file to extension .php
  3. Upload it to WordPress wp-content/plugins directory.

WARNING: This plugin is not guaranteed to be problem free. Use it at your own risk.

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注

%d 博主赞过: