I have multiple domains pointed to certain WordPress installations that I run. Some people have setups like this and run multiple sites in their WP install. I, on the other hand though, wanted to redirect all requests for certain domains to a single domain. Basically consolidating the domains so the users all wind up on what I decide as the primary domain regardless of which domain they enter.
I first tried to do this with Redirection but that plug-in doesn’t seem to quite handle things the way I wanted.
After some stumbling around I found a setting within WP itself that does the trick – no plug-in or anything else fancy needed.
What I did was change the “WordPress Address (URL)” and “Site Address (URL)” settings (boxed in red above), which are found on the Settings->General options page, to both be the primary domain name exactly as I wanted it to be. Then, presto, it auto-redirected all traffic to that domain.
Now, let me note, when I first did this, the site broke for a little while. The reason was that WP was now “looking” for things in a new location and my local browser had some old data cached. It was fine in reality (for the rest of the world) but looked broken for me. After just about two minutes, the cached data seemed to have resolved itself and everything was fine.
So, to summarize with an example, I have both www.site1.com and www.site2.com pointing to a WordPress installation. But, if WP notices the www.site2.com domain it performs a redirect and reloads the site with the www.site1.com domain as I designated.
Nice trick. I hope this tip helps.