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.

2 Responses to “Temporary Redirection Plugin for Wordpress”

  1. ToNnI Says:

    这样的话貌似在htaccess定义了url 重写之后不行。。至少在我那儿不行。。
    所以我就改用$_SERVER['REQUEST_URI']了。。。

  2. wangxiaohu Says:

    没看明白。啥意思?


Chat with me. =)