[wp-hackers] Why WP_SITEURL and not $_SERVER['HTTP_HOST']?

Otto otto at ottodestruct.com
Wed Mar 31 13:52:40 UTC 2010


On Tue, Mar 30, 2010 at 4:40 PM, Mike Schinkel
<mikeschinkel at newclarity.net> wrote:
> I found the RELOCATE after emailing the question and explored it.  Seems it only works for the wp-login.php page.  It also seems (in a good way) like it started to address this issue in a first step kind of way.

Well, it mainly only addresses the one point from your first post in
this thread. Basically, setting RELOCATE causes it to change the
siteurl in the database based on the HTTP_HOST variable. The idea
being that you move the files to the new domain, set relocate, then
load the page for the first time, and it recognizes and fixes up the
url by itself.

This doesn't address changing anything else in the database,
obviously. URLs in posts are the same, etc. It's just to get the
wp-admin section working. It only works for the wp-login because after
it's changed, you would then remove the relocate flag.

> The next step might be to add a 'relocate' hook to run when that flag is detected, assuming that is the right place for it (as I've not tried it yet I can't be sure.)

Hook to update_option_siteurl. Then you can take appropriate action
whenever the siteurl is changed.

> Another thing is RELOCATE being in wp-login.php doesn't address taking the site offline until everything has been fixed-up.

Creating a .maintenance file will do that.

-Otto


More information about the wp-hackers mailing list