WordPress.org

Ready to get started?Download WordPress

Forums

siteurl & home options (6 posts)

  1. AlexisWilke
    Member
    Posted 7 years ago #

    As I was installing WordPress, it worked in less than 5 minutes as promised.

    When I then renamed and moved the folder, it broke in less than 1 minute.

    When you move the folders, in other words, when you change the URL, the system breaks. This is because in many places you use the siteurl and home options from the database. Whenever you move the WordPress code, you need to edit the database and fix the URL in there too.

    In itself, it is easy, but rather annoying. It seems to me that the wp-admin pages should not be affected by such a move. At least those pages that are required to fix the URLs mentioned. Then you could use the wp-admin to do the database update (much easier than doing an SQL UPDATE... but I know I'm complaining too much here...)

    Anyway, if you have that problem, you need to run this command:

    UPDATE wp_options SET option_value = 'http://...' WHERE option_name IN ('siteurl', 'home');

    Then go edit the home URL if you want a different one.

    It seems to me that the URL should not be necessary because it should always be available dynamically at run time. But I suppose that you have done this because you had the opposite problem...

    This was certainly the most annoying part as I was tweaking WordPress.

    Thank you.
    Alexis

  2. MichaelH
    Member
    Posted 7 years ago #

  3. AlexisWilke
    Member
    Posted 7 years ago #

    Thank you Michael.

    What I can see in the pages you pointed out is that the siteurl and home options are there to stay and allow WordPress to be in one location and the index.php in another (btw, about the 2nd link Giving WordPress its own Directory, if my root site already has an index.php, I'm in big trouble... I would need a way to rename that file and have all the links point to that new name! but anyway... not my problem in this case!)

    The last link shows that I can use phpAdmin instead of direct SQL. I think I'm much better with direct SQL commands. What I was pointing out is the fact that between the time you move things and fix the database, WordPress cannot be used.

    On my end, I changed the get_option() function in wp-includes/functions.php so 'siteurl' and 'home' return a dynamically defined URL. To me that makes much more sense...

    if($setting == 'siteurl' || $setting == 'home')
            {
                    // get_blog_name() is defined in wp-config.php
                    return '@PROTOCOL@@SERVER_NAME@@SCRIPT_NAME@/blog/' . get_blog_name();
            }

    Now, be careful, because this prevents the installation from create the siteurl option and thus it looks like the installation does not work (if you keep that code when installing that is--just mentioning in case someone was silly enough to use this code!)

    Thank you.
    Alexis Wilke

  4. moshu
    Member
    Posted 7 years ago #

    Don't come and give advices to mess with the WP core files! Bad karma. Novice users are screwed up enough with the standard installation. :)
    No need for them to find this post and get even more confused.

    What I was pointing out is the fact that between the time you move things and fix the database, WordPress cannot be used.

    That's 2 minutes if you know what are you doing and follow the instructions. No need to re-invent the wheel...

  5. AlexisWilke
    Member
    Posted 7 years ago #

    Sorry... Did not mean to imply that WP is bad. But this one thing is a gotcha 8-)

  6. moshu
    Member
    Posted 7 years ago #

    I know you didn't imply that. Don't read more into my post than what is there.

    You come here and in your first 16 hours you only post topics about messing with the core files.
    I don't like that because ignorant users will try it and then will come to cry here and the regular helpers will have to clean up the mess after you. It is that simple.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.