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,
- Give $target_host a new value
- Rename the file to extension .php
- Upload it to WordPress wp-content/plugins directory.
WARNING: This plugin is not guaranteed to be problem free. Use it at your own risk.